I have been trying to understand the basic idea behind UDP hole punching, and I'm having trouble understanding the difference between the following two socket bindings:
sock = UDPSocket.new
sock.bind('', port )
and
sock = UDPSocket.new
sock.bind('0.0.0.0', port)
Previously I had thought using '' or '0.0.0.0' did the same thing -- allow the socket to listen on any network interface -- but since the code didn't work with them interchanged I must be missing something.
For the initial 'punch' the datagram is sent from a socket bound to '', which is then closed and the actual communication with the remote host is done over a socket bound to 0.0.0.0. I know 0.0.0.0 generally refers to the default route, but I can't figure out the significance of that in this situation. Does binding a socket to 0.0.0.0 mean you're assigning it the address of the default gateway?