I went through the Programming P2P application SO post. but I think I'm still unclear as to how the STUN work under the hood.
So, I would like to post my understanding and hope to get them corrected.
as per the example
assuming that machine (A) IP is 192.168.1.2
running on (TCP client request on STUN server) 4900
(TCP client request STUN server over TCP running at 4900
) and Stun server returned the Public IP of the Nat device i.e 128.11.12.13
8888
Now I want the Machine B(assuming now B knows by public IP 128.11.12.13
) to connect to machine A over port 3000
(TCP)
What happened after this -
B tried to connect A with IP on 128.11.12.13
Question 1: But which port? (It cant connect to port 3000 directly )
I guess the answer to that would I port forwarding the 4900
request to 3000
.
But here a thing
Question-2: 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?
Am I correct on this?
What way around for this or am I thinking out loud over here? :)
3000
I won't be able to start a TCP server at the specific port i.e3000
because of it, right?. Assuming the TCP server is would be usingany address
– Bossy