[Gambas-user] UDP hole punching

Brian G brian at westwoodsvcs.com
Fri Jun 4 14:40:39 CEST 2021

It is far more difficult for tcp as it is a bidirctional protocol which requires an open connection.  Nat port translation is not predictable.
Both sessions must guess the port number the nat will allocate to the peer and then do an open port on the others sides nat port.  Some nat processes do not support predictable port allocation . So is not a very reliable way to do this in tcp .
Better to map a port number in this case on the client I think.
Most routers now a day support port mapping through upnp.  
Brian G Friday, 04 June 2021, 03:34AM -07:00 from John Dovey  dovey.john at gmail.com :

>>I am attaching a demo that shows it works beautifully.
>yYes it does!! Thank you, tested it and I could get two clients, each behind their own NAT, to send and receive data via UDP. 
>>One more thing to pay attention to!
>>Need to occasionally communicate minimally with the server, otherwise it may lose connection
>Let me see if I understand exactly what’s happening here. 
>A public server is running udp01. That is always available and can be contacted by anyone who initiates a connection.
>When client A and B both connect to the server, your program connects them together and that established the path that all further UDP traffic between A and B will flow.
>To ensure the path remains open, A and B need to contact the server once a minute or so…
>Is that essentially correct?
>Now for my next question. Is it possible to do the same for tcp?
>Sent from Gmail Mobile
>----[  http://gambaswiki.org/wiki/doc/netiquette ]----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210604/af0516fe/attachment.htm>

More information about the User mailing list