UDP: Port unreachable

Hey again…
So I finally made my game work with UDP, from localhost to localhost =/
When I try to play over a network, I get ICMP messages back telling me that the port is unreachable (tried it with ethereal).

I start the UDP server on port 27901, and send UDP packets there… I tried it with port 9001 as well.

Anyone got a idea?

Hi
What interface are you listening on at the receiving end(s) ?, if you are on linux, can you use nc to conenct to that udp port?, can you ping the machine, are they both on the local lan, or is one outside it?

Cheers

Endolf

I tried with a test program to open a socket and send data to it and it worked from localhost to localhost… How would I try to send/get data with nc ?

Perhaps I am binding the socket wrong? Maybe java is doing some security checks that only allows localhost to send data to it?


channel = DatagramChannel.open();
                ((DatagramChannel)channel).socket().bind(inetAddress = new InetSocketAddress("localhost", port));

yeah that was it, I removed the “localhost” and now it works :wink: thanks

I’m no UDP expert here, but it looks like you tried to bind the listening socket to the localhost interface. No packet can reach that interface except those coming from the same machine. Removing it made your socket bind to all interfaces available on your system, that is, the local interface and any adapter interfaces. In short, I don’t think it was a security measure :slight_smile:

  • elias