[Gambas-user] UDP hole punching
brian at westwoodsvcs.com
Wed Jun 2 01:01:23 CEST 2021
I thought the nat took care of that..
A and B each begin a UDP conversation with S; the NAT devices NA and NB create UDP translation states and assign temporary external port numbers EPA and EPB.
S examines the UDP packets to get the source port used by NA and NB (the external NAT ports EPA and EPB).
S passes EIPA:EPA to B and EIPB:EPB to A.
A sends a packet to EIPB:EPB.
NA examines A's packet and creates the following tuple in its translation table: (Source-IP-A, EPA, EIPB, EPB).
B sends a packet to EIPA:EPA.
NB examines B's packet and creates the following tuple in its translation table: (Source-IP-B, EPB, EIPA, EPA).
Depending on the state of NA's translation table when B's first packet arrives
(i.e. whether the tuple (Source-IP-A, EPA, EIPB, EPB) has been created by the time of arrival of B's first packet),
B's first packet is dropped (no entry in translation table) or passed (entry in translation table has been made).
Depending on the state of NB's translation table when A's first packet arrives
(i.e. whether the tuple (Source-IP-B, EPB, EIPA, EPA) has been created by the time of arrival of A's first packet),
A's first packet is dropped (no entry in translation table) or passed (entry in translation table has been made).
At worst, the second packet from A reaches B; at worst the second packet from B reaches A.
Holes have been "punched" in the NAT and both hosts can directly communicate.
>From this it looks like your app get a message from S the go between containing the ip and port and then creates an outbound connection to the other host
looks like you just need to read s's message and create a new udp connection to B.
Maybe I am just miss reading or don't get what you are doing.
Do you have a sample program?
"Failure is the key to success;
each mistake teaches us something" .. Morihei Ueshiba
----- On Jun 1, 2021, at 10:43 AM, Mayost Sharon sharon at 455.co.il wrote:
> Hello to you
> Can it be done:
> UDP hole punching
> I understand that I need to change:
> UdpSocket.SourceHost and UdpSocket.SourcePort
> And they are for reading only
> They cannot be changed
> Is there another way to perform: UDP hole punching
> Thank you
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
More information about the User