SOLVED! Arduino yun- network printer

I am new to Arduino yun and my project is about using Arduino to send data(after receiving them from a sensor, but this is another topic which I am not discussing here) to a network printer, where they get printed. provided that I have the network IP-adresse and the port to the printer(192.168.0.120 / 9000 ), how can I realize that in code, using my Arduino Yun? At the moment- as there is no printer available now- I am connecting the Arduino Yun to the network with my computer and using the network Ip-addresse of the computer and then watching the ports and connections on it(using resources monitor/ LiveTcpUdpWatch programmes). there seems to be connections between them but not as I expect, because I see ports like 137/65474 … but I don't see connections to port 9000 which is written in my code. The code I am using is

#include <Bridge.h>
#include <YunClient.h>


#define PORT 9000

// Define our client object
YunClient client;
bool Connected;

// Make the client connect to the desired server and port
IPAddress addr(192, 168, 0, 120);

void setup()
{
  pinMode(13, OUTPUT);
  digitalWrite(13, HIGH);
  // Bridge startup
  Bridge.begin();
  
  Console.begin();
  while (!Console)
  {
    digitalWrite(13, HIGH);
    delay(125);
    digitalWrite(13, LOW);
    delay(125);
  }  
  Console.println("Client connecting on port 9000");
  Connected = false;
}

void loop()
{
  // Is a connection currently active?
  if (!Connected)
  {
    // Not currently connected, try to establish a connection
    client.connect(addr, PORT);
    if (client.connected())
    {
      Console.println("Connected to the server.");

      // Send something to the client
      client.println("Hello Server!");
       
      // Remember that there is a connection
      Connected = true;
    }
    else
    {
      // The connection attempt has failed.
      Console.println("Could not connect to the server.");  
    
      // Give some time before trying again.
      // A real program needs to be more inteligent here.
      delay(5000);
    }
  }
  
  // Is a connection currently active?
  // Not an ELSE clause from the above IF, because a
  // new connection might have just been established.
  if (Connected)
  {
    // We think we are connected. Is that true?
    if (client.connected())
    {
      // Yes, we really are connected.
      // Send something to the client
      client.println("Data...");
      
      // Delay just to prevent too much data streaming
      // to the server, a real application will need to
      // be more intelligent here.
      delay(1000);
      
      // Read all incoming bytes available from the server and print them
      while (client.available())
      {
        char c = client.read();
        Console.print(c);
      }
      Console.flush();
    }
    else
    {
       // We think we are connected, but we aren't.
       // The connection must've just closed on us.
       Console.println("Server connection closed!");
       
       // Clean up the client connection
       client.stop();
       
       // Track that we are no longer connected.
       // This will try to establish a connection the next time around.
       Connected = false;
    }
  }
}

I found it on this forum but I am not sure if it is the right one as I get on the serial monitor 'Client connecting on port 9000

could not connect to the server'

I found it on this forum but I am not sure if it is the right one as I get on the serial monitor 'Client connecting on port 9000

Ensure there is a server listening on the given IP address and the given port. According to your description you simply monitor the TCP connections but as there is no opposite party responding a TCP connection is never established. Also ensure that the Yun is able to reach that address. If the Yun got address 192.168.1.54 and no gateway it cannot reach the requested IP.

Thanks for your response.

pylon:
Also ensure that the Yun is able to reach that address. If the Yun got address 192.168.1.54 and no gateway it cannot reach the requested IP.

The Arduino yun and the Computer are connected to the same router. According to the router webpage, the computer got the ip: 192.168.0.120 which I used in the code. The arduino got the ip: 192.168.0.102. I think this is fine for this part, right?

pylon:
Ensure there is a server listening on the given IP address and the given port. According to your description you simply monitor the TCP connections but as there is no opposite party responding a TCP connection is never established.

Here I don't understand what I need to do exactly! I read this phrase(server listening..) lately so much and I thought i did that by "monitoring". What should I do to make a server listens to the connection? Is there a program for this or what? Sorry if my question is trivial, but I am new and I didn't think it's that complicated

Hey, I found "Netcat" and used it to listen to the port and it worked!!! many thanks pylon!