Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
added 2 characters in body
Source Link
Nikolai Fetissov
  • 84.6k
  • 13
  • 118
  • 175

Unless I'm missing something in understanding your question you have two client-style applications. Both try to connect to port 55555 on the other host. I have no idea how it works for you on single box.

Let me describe normal client-server (a.k.a active/passive) scenario:

  1. server creates UDP socket and bind(2)s it to known port (55555 in your example),
  2. server calls recv(2)-family function on the socket to accept data from clients,
  3. client creates UDP socket and calls sendto(2) function with destination address argument initialized with servers's IP address and that known port number.
  4. server returns from the recv(2) with the data from client,
  5. optionally client and server exchange more messages.

The key is that you need bound known port on the server side. Server, on the other hand, doesn't need to know address and port of the client, thus server is passive and client(s) is/are active. I should probably add that it's not uncommon for UDP applications to act as both clients and servers at the same time. It's just logically these are separate roles.

That out of the way, there could be a couple of reasons why you get "ICMP port unreachable" response:

  • No process is bound to the port on the server machine (see point 1. above),
  • A firewall on the server machine actively rejects packets sent to that port.

Hope this clears it a bit. Let me know if I grossly misunderstood what you are asking.

Unless I'm missing something in understanding your question you have two client-style applications. Both try to connect to port 55555 on the other host. I have no idea how it works for you on single box.

Let me describe normal client-server (a.k.a active/passive) scenario:

  1. server creates UDP socket and bind(2)s it to known port (55555 in your example),
  2. server calls recv(2)-family function on the socket to accept data from clients,
  3. client creates UDP socket and calls sendto(2) function with destination address argument initialized with servers's IP address and that known port number.
  4. server returns from the recv(2) with the data from client,
  5. optionally client and server exchange more messages.

The key is that you need bound known port on the server side. Server, on the other hand, doesn't need to know address and port of the client, thus server is passive and client(s) is/are active. I should probably add that it's not uncommon for UDP applications to act as both clients and servers at the same time. It's just logically these are separate roles.

That out of the way, there could be a couple of reasons why you get "ICMP port unreachable" response:

  • No process is bound to the port on the server machine (see point 1. above),
  • A firewall on the server machine actively rejects packets sent to that port.

Hope this clears it a bit. Let me know if grossly misunderstood what you are asking.

Unless I'm missing something in understanding your question you have two client-style applications. Both try to connect to port 55555 on the other host. I have no idea how it works for you on single box.

Let me describe normal client-server (a.k.a active/passive) scenario:

  1. server creates UDP socket and bind(2)s it to known port (55555 in your example),
  2. server calls recv(2)-family function on the socket to accept data from clients,
  3. client creates UDP socket and calls sendto(2) function with destination address argument initialized with servers's IP address and that known port number.
  4. server returns from the recv(2) with the data from client,
  5. optionally client and server exchange more messages.

The key is that you need bound known port on the server side. Server, on the other hand, doesn't need to know address and port of the client, thus server is passive and client(s) is/are active. I should probably add that it's not uncommon for UDP applications to act as both clients and servers at the same time. It's just logically these are separate roles.

That out of the way, there could be a couple of reasons why you get "ICMP port unreachable" response:

  • No process is bound to the port on the server machine (see point 1. above),
  • A firewall on the server machine actively rejects packets sent to that port.

Hope this clears it a bit. Let me know if I grossly misunderstood what you are asking.

Source Link
Nikolai Fetissov
  • 84.6k
  • 13
  • 118
  • 175

Unless I'm missing something in understanding your question you have two client-style applications. Both try to connect to port 55555 on the other host. I have no idea how it works for you on single box.

Let me describe normal client-server (a.k.a active/passive) scenario:

  1. server creates UDP socket and bind(2)s it to known port (55555 in your example),
  2. server calls recv(2)-family function on the socket to accept data from clients,
  3. client creates UDP socket and calls sendto(2) function with destination address argument initialized with servers's IP address and that known port number.
  4. server returns from the recv(2) with the data from client,
  5. optionally client and server exchange more messages.

The key is that you need bound known port on the server side. Server, on the other hand, doesn't need to know address and port of the client, thus server is passive and client(s) is/are active. I should probably add that it's not uncommon for UDP applications to act as both clients and servers at the same time. It's just logically these are separate roles.

That out of the way, there could be a couple of reasons why you get "ICMP port unreachable" response:

  • No process is bound to the port on the server machine (see point 1. above),
  • A firewall on the server machine actively rejects packets sent to that port.

Hope this clears it a bit. Let me know if grossly misunderstood what you are asking.