0

I am running a UDP client that listens to the multicast ip 230.10.10.10 , port 11111 for messages. IF I run the client java code in the same server as the UDP broadcaster, I am able to receive the UDP message. However, if I run it in another server in the same domain, I am not getting any messages.

I am using windows server 2008. Kindly let me know how to debug it ?

user207421
  • 305,947
  • 44
  • 307
  • 483
Dunxton
  • 408
  • 1
  • 8
  • 21

3 Answers3

1

firstly, UDP is not a guaranteed delivery protocol. secondly, the UDP packets could be firewalled or filtered on your network.

can you connect from the client machine to the server machine on port 11111?

mcfinnigan
  • 11,442
  • 35
  • 28
  • I second that. Likely one of your routers filters the UDP packages. Could even be the local firewall of your "server". – Angel O'Sphere Sep 16 '11 at 15:25
  • Since it's a server , I cannot disable the firewall. However I have added exceptions to port 11111 in the firewall settings. What I want to know is , how do I ascertain it is a firewall problem or a router filter problem ? Are there any tools or anything helper classes to debug this ? – Dunxton Sep 17 '11 at 05:56
1

Thanks for the help guys.I have it resolved now. The solution was to call the setInterface() method in the Listener

DatagramSocket datagramSocket = new MulticastSocket(multicastPort);
((MulticastSocket) datagramSocket).setInterface(inetNicAddress);

The broadcaster is multihomed, having two IP addresses and the listener has a single IP.So, when I set the listener IP in the setInterface method, it worked fine.

But I am still not sure how this works though, because the setInterface method is called in the broadcaster as it is multihomed and thats okay. But why is it necessary to set it in the listener also ? . Any advice will be helpful.

Dunxton
  • 408
  • 1
  • 8
  • 21
  • Good to hear you finally got a solution. I'd suggest you ask a new question about this instead a question inside your own answer. Otherwise hardly anybody will find it. – jeha Sep 20 '11 at 21:10
0

The problem might also be the TTL of the multicast packets. If it's 0 then the packages can only be received locally. I'd recommend you to inspect the network traffic with a tool like Wireshark. If that's the problem, increase the TTL value to 32. You might also need to set -Djava.net.preferIPv4Stack=true.

Community
  • 1
  • 1
jeha
  • 10,562
  • 5
  • 50
  • 69