0
votes

RTCPeerConnection manages the full ICE workflow for NAT traversal. So, if we assume that we have two computers residing to two different private networks, the RTCPeerConnection API will gather the possible IP and port candidates for each peer, traverse the NATs, and then run the connectivity checks to find the ones that work.

Assuming that everything goes well we have an open peer-to-peer connection between the two parts. On a video conferencing application this means that the video and audio streaming of the first peer passes its network gateway and travels all the way to the other part's NAT. It enters the NAT and then it is directed to the receiver peer.

But what if the two peers reside on the same private network? What happens in that case? Does the data travels only within the local private network or is it transmitted to the other peer by first going out of the NAT and then entering back in? In other words, does this data transmission consumes internet bandwidth or not?

2

2 Answers

0
votes

Yes, when they are in the same network they get connected directly. You can read some concepts here.

0
votes

ICE Servers are usually smart enough, this includes both STUN and TURN, to recognize that both parties are behind the same NAT.

If the parties are in the same NAT, the traffic will not leave that network. It will go directly between the two parties. I know specifically that this is the case with google's open stun servers(stun.l.google.com:19302 || 23.21.150.121) and with the rfc5766-turn-server.

You can also NOT have any ICE servers and it will only utilize local IPs and Ports for the candidates and it will work just fine.