Re: (#552) Re: Poll: Both ends behind NAT...

Soren H <[email protected]> Tue, 25 Nov 2003 16:57:30 +1100
Newsgroups gmane.comp.audio.speak-freely.general
Message-ID <[email protected]>
On Mon, Nov 24, 2003 at 09:28:54PM -0800, Gregory Forrest wrote:
> 
> > Here is a patch that supposedly gives NAT traversal ability. I don't have
> a
> > windows machine to test it.
> >
> > http://www.2pi.info/software/sf_speex/speakf76_20031030.exe.zip
> 
> 
> Does anyone know where I might find a technical description of how NAT
> Socket Sharing/traveral operates?
> 

Some of the principles are here:

http://www.alumni.caltech.edu/~dank/peer-nat.html


In the case of speakfreely, it is simply a matter of ensuring that the
outgoing UDP packets are sent from the same port number as what it is
using to listen for incoming packets.  It's really the NAT that does
the magic, but the application needs to play it nice with the port
numbers so the NAT knows what to do.  Once a packet is sent out from
port P to remote host X, the NAT knows that traffic from remote host X
back to port P needs to get routed back to that machine.

As only one socket can be bound to any given port, it means that the
same socket must be used for the listen and send calls.  That's what
the patch does.  It's pretty simple in the windows version, and the
only downside is that you can't connect() the socket (for
performance), or else you can only ever receive packets from one
remote source.

The NAT patch just replaces the calls to create transmit sockets, and
instead uses the value of the existing listening socket.

Also, this is not strictly about "NAT".  In my use it also overcomes
traversal through a simple firewall which is otherwise a problem.

Soren

                      * * *

To unsubscribe from this mailing list, send E-mail containing
the word "unsubscribe" in the message body (*not* as the
Subject) to [email protected]