[Twisted-Python] UDP File Copy

Antoine Pitrou solipsis at pitrou.net
Wed Apr 6 03:18:53 MDT 2005


Le mardi 05 avril 2005 à 15:31 -0400, Tom Carmichael a écrit :
> UDP has it's place, but typically vanilla file transfer isn't it. 
> 
> UDP traffic typically is harder to NAT rather than easier.  Since it
> is a stateless protocol, what is meant by a 'reply'?  How do you keep
> a forward and reverse translation table for the communications?

It is only harder for people who design NAT devices. ;)

But the real difference here between UDP and TCP, is that when you open
an outbound TCP connection, incoming TCP traffic will only be allowed
*for that connection*. Whereas if you send an outbound UDP message, *all
incoming UDP traffic* towards the originating address/port will be
enabled (at least on some NAT boxes).

This makes it easy for P2P systems to exchange messages between two
NATted clients without any proxying/tunnelling mechanism: you just have
to "punch a hole" by sending sporadic outgoing UDP traffic from your UDP
socket and then you can receive all UDP traffic coming to that socket.
You can't do that with TCP.

Regards

Antoine.






More information about the Twisted-Python mailing list