I've created client and serversoftware who use UDP for transferring data (We need to use UDP because of TCP bandwidth limitations). When i run it over localhost it runs like i want it, so I moved the server application to an actual server and that's when things went wrong.
After an hour of debugging and tracing this is what happens:
- Client sends a DatagramPacket over an DatagramSocket.
- The server(computer) receives it.
- The application never receives it and never sends the correct packet back.
- My OS sends a ICMP message back: destination unreachable (Port unreachable)
The client is running on port 25055 and the server on 25056-25060. In the Wireshark trace I've made I can see that the packet is send from and to the correct port. I've already disabled the firewall and gave topuser permissions to the software.
Important pieces of code:
socket = new DatagramSocket(clientPort);
socket = new DatagramSocket(serverPort);
private void sendPacket() throws Exception
{
packet = new DatagramPacket(data, data.length, address, serverPort);
socket.send(packet);
}
private void receivePacket(int packetSize) throws Exception
{
if(data == null || data.length != packetSize)
data = new byte[packetSize];
packet = new DatagramPacket(data, packetSize);
socket.receive(packet);
}
Does anyone has an idea of why this is happening? Any idea's would be greatly apreciated.