Hey guys I am working on a project where I need to broadcast a UDP packet on the actual internet and also receive them on the client. Currently I am using the multicast socket for broadcasting the packet on the local lan. I had come across this project called jstunt for NAT traversal of a UDP datagram but cant find any relevant documentation on it and also no implementation. I am familiar with the concepts of Nat Traversal, UDP hole punching but am facing the same problem as above, no relevant documentation and implementation. So can anyone please help and also suggest some other techniques for achieving this.
Share
As the other poster has mentioned, you can’t really “broadcast” a packet freely to the internet. If that were possible, networks could easily be DOS’d and incredible congestion would result. Even within controlled networks, broadcasts are usually tightly controlled so that they do not get out of hand. That said, perhaps you don’t really need to “broadcast” the packet.
If you need to create a UDP “tunnel” across the internet, such as how P2P software works, it can be done. The trick is usually NAT. You mentioned you were already familiar with UDP hole punching, but couldn’t figure out how to make it work. Here are some Java libraries that can be used for this:
http://www.masquerade.cz/en/nat-tunel-metodou-udp-hole-punching-v-jazyce-java/
http://ulno.net/projects/jpunch/
http://samy.pl/pwnat/
Also check out UPNP: http://en.wikipedia.org/wiki/Universal_Plug_and_Play
And the STUNT library: http://nutss.gforge.cis.cornell.edu/stunt.php