UDP Hole Punching: Possibility of Testing on a Single Machine

I am writing a simple P2P application to test the possibility of using a UDP hole in a larger project.

Yesterday I tried my test applications from home and they worked.

However, I'm at work right now, and the same code no longer does the job. The sender sends the external IP address of our router here to the appropriate port, but the receiver does not receive any of them.

Before the call UdpClient.Receive(), the receiving application sends the packet to the IP port that it will listen on. Again, this works on my home installation, but not here. The result is the same regardless of whether the Windows Firewall is on or off, so this is not a problem.

Maybe routers handle the situation differently?

EDIT1: Both applications run on the same computer.

+5
source share
2 answers

In response to my own question:

Routers did exhibit different behaviors.

My home router is connected to my laptop. I assume that therefore, when I send a UDP packet from port n , it also leaves the router on port n .

However, my work network consists of several computers, and the router randomizes the port at its end, which means that a packet sent from port y will leave the router on port x .

NAT :

H - a W: b, a

W - H: a . .

H - W , , , , .

H - W:

W - .

Voila.

tho, H W , , , H W .

+2

, , . UDP , .

Skype man-in-the-middle, NAT - . .

0

All Articles