title: Understanding Stun working
body: <p>I went through the <a href="https://stackoverflow.com/questions/8523330/programming-p2p-application/8524609#8524609">Programming P2P application</a> SO post. but I think I'm still unclear as to how the STUN work under the hood.</p>
  
  <p>So, I would like to post my understanding and hope to get them corrected.</p>
  
  <p>as per the example </p>
  
  <p>assuming that machine (A) IP is <code>192.168.1.2</code> running on (TCP client request on STUN server) <code>4900</code>(TCP client request STUN server over TCP running at <code>4900</code>) and Stun server returned the Public IP of the Nat device i.e <code>128.11.12.13</code> <code>8888</code></p>
  
  <p>Now I want the Machine B(assuming now B knows by public IP <code>128.11.12.13</code>) to connect to machine A over port <code>3000</code> (TCP)</p>
  
  <p>What happened after this - </p>
  
  <p>B tried to connect A with IP on <code>128.11.12.13</code> </p>
  
  <p><strong>Question 1</strong>: But which port? (It cant connect to port 3000 directly ) </p>
  
  <p>I guess the answer to that would I port forwarding the <code>4900</code> request to <code>3000</code>. </p>
  
  <p>But here a thing </p>
  
  <p><strong>Question-2</strong>: what about to the TCP client connected to STUN server on 4900 (sending indication etc). If the port forwarding is applied all traffic from Stun server to TCP client will now be redirected to port 3000. Right? </p>
  
  <p>Am I correct on this? </p>
  
  <p>What way around for this or am I thinking out loud over here? :)</p>