Answer the question
In order to leave comments, you need to log in
How to link 2 PCs behind NATs in python?
Good day!
There are 3 hosts:
1 and 2 => clients behind NAT. If you try to determine the type of nat through STUN, then it writes Full Cone Nat (moreover, one of them (2) depending on the STUN server used - either full cone or symmetric)
3 => server with a white ip.
The question is how, having these 3 components, connect 1 and 2 directly using python sockets.
Here is an example of what I did:
1) From (1) I send a udp packet to (3).
2) On (3) I receive this packet and find out the external ip and port (1).
3) With (2) I send a udp packet to the ip and port (1) that I received in step 2.
and nothing comes through.
What am I doing wrong, and maybe there are ready-made libraries for this in python?
Answer the question
In order to leave comments, you need to log in
If 1 port is not thrown into the network to the desired host, then it is not surprising that it does not work.
Raise a VPN server on a server with a white IP IP (there are a lot of instructions), install vpn clients on the computers behind nat and drive whatever your heart desires.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question