Discussion:
Hall Punching
(too old to reply)
Gomez
2010-07-23 16:46:56 UTC
Permalink
Raw Message
I wrote some program that "puches" a NAT router (UDP) and it works fine.
After "punching" the communication goes always only from one peer to the
other, and never in the opposite direction.
Do I have to send from the passive peer(the one that never sends) some
packets, like keep alive, to maintain the connection(from the NAT router
point of view).
Regards
Gomez
Oliver duCille
2010-10-05 04:50:34 UTC
Permalink
Raw Message
Gomez, the answer is yes! You do need to implement a keep alive scenario at intervals shorter than the NAT (Network Address Translation) timeout. The default NAT time out for most routers is 180 seconds. It is also configurable. To be safe I suggest pinging a rendezvous machine every 90 secs where it could reply with the external ip and port to the client machine in response to the request (the ping). This starts the NAT timeout clock over therby keeping the port open. This serves quite a utility in many applications. Actually if your NAT is a full cone NAT (you hope), all requests from the same internal ip and port are mapped to the same external ip and port. To shed a bit more light on the subject, such a machine is called a STUN server. STUN is defined as Simple Traversal of UDP over NAT and has been redifined as Session Traversal Utilities for NAT. I suppose that this is due to the fact that methods (STUNT or STUNTCP) have been developed that allow for the graceful graduation of a UDP session initiated by STUN to a TCP session. STUN is essential to the Session Initiation Protocol (SIP). In sip, User Agent (Clients) would "ping" or send a Registration Request to a SIP Proxy after requesting it's external IP and Port from a STUN Server. Since NAT timeout's vary Registration refresh periods can range from as low as 30 seconds to about 90 secons. These methods heralded in the creation of VOIP.
Post by Gomez
I wrote some program that "puches" a NAT router (UDP) and it works fine.
After "punching" the communication goes always only from one peer to the
other, and never in the opposite direction.
Do I have to send from the passive peer(the one that never sends) some
packets, like keep alive, to maintain the connection(from the NAT router
point of view).
Regards
Gomez
Submitted via EggHeadCafe - Software Developer Portal of Choice
ASP.NET HttpPostedFile Image Resizer
http://www.eggheadcafe.com/tutorials/aspnet/ba8d2418-6d67-40f7-989c-e90688058778/aspnet-httppostedfile-image-resizer.aspx
Loading...