UDP Datagram Sockets
ipssheldon
Posts: 106
Has any one used Datagrams to send UDP packets with Java or Duet? I'm having an issue changing the setTimeToLive parameter associated with Datagrams. In Netlinx (and maybe Java), the default value is 1 which means that broadcast packets (to addresses like 192.168.15.255) are thrown away after 1 hop in networking switches/routers. In many cases, this is not sufficient. Java has support for changing this value, but I've yet to get my code to work. I can post the code or handle this offline if anyone has tackled this issue before.
Just curious before I bore everyone with a long post.
Thanks in advance.
Just curious before I bore everyone with a long post.
Thanks in advance.
0
Comments
The broadcast will not propogate through a router, it should go through the switches though.
The UDP Broadcast is limited to the subnet it is on, and routers will not route a broacast.
A TTL should only be decremented by a router in anycase, so I'm a little confused.
Java provides the mechanism to change this. I just haven't been successful in getting the code to work. I was hopeful that someone might know what I'm doing wrong.
Jeff
The strange thing, however, is after implementing MulticastSockets, I was still not able to route between broadcast addresses to a single subnet (addresses such as 192.168.65.255), but I am able to use a multicast address, such as 224.1.1.100.
The other strange result is that after I made this change, even setting the TTL to a value of 1 still works. So, I may simply have too flat a network to do a true test. But since MulticastSockets give me direct control of the TTL value, this hopefully, won't be a problem in the field. I'll have to work on my network to get a better setup so that a TTL of 1 fails to route packets, but values greater than 1 do route messages.
Jeff was accurate in his comments, as well. For broadcast messages, the TTL determines how many hops the networking devices will propogate a message. Messages to a direct IP are not affected, only broadcast messages (x.x.x.255 and multicast messages above 224.0.0.1).
Thanks for the replies.