title: UDP P2P connection behind NAT
body: <p>I want to make P2P connection between 2 clients behind NAT. I studied methods to make it work and I want to try "UDP hole punching method". </p>
  
  <p>So...</p>
  
  <p>I made a server in PHP, which can send connection details to clients on demand (Like remote IP, remote port).</p>
  
  <p>Source code as example is here: <a href="http://pastebin.com/FdiKMSFq" rel="nofollow">http://pastebin.com/FdiKMSFq</a></p>
  
  <p>Next, I made an Client in C# which permanently connects to server and ask him about another client info. Client recieves remote IP and remote port (used for connection with server) of another client and tries to connect.</p>
  
  <p>Full source code here: <a href="http://pastebin.com/VUJyZivW" rel="nofollow">http://pastebin.com/VUJyZivW</a></p>
  
  <p>First step (connecting, and asking for details) are OK, but when client (A) connects to another client (B) and send some data (A->B), client B do not recieve any data.</p>
  
  <p>I set both IPEndPoints working with port 2000. But it didn't work anyway.</p>
  
  <p>Example:</p>
  
  <ul>
  <li>A: 192.168.1.11:2000, server gets 32.14.15.16:56666 </li>
  <li>B: 192.168.1.5:2000, server gets 32.99.15.16:56699 </li>
  <li>A tries to connect on 32.99.15.16:56699 and send some data</li>
  </ul>