what is STUN stun.l.google.com:19302 used for

Vicky picture Vicky · Nov 19, 2013 · Viewed 51.8k times · Source

I'm looking at the webrtc.html and peerconnection_server demo, and it is working fine between two Chrome browsers. My question is, what exactly is the first param of webkitPeerConnection ?

pc = new webkitPeerConnection("STUN stun.l.google.com:19302", onSignalingMessage);

Is it a third party STUN server given by Google for demo purpose ? If, in my JavaScript code, I replace "stun.l.google.com:19302" by "toto", I'm still able to make video calls. But as I'm on the same subnet, this can be explainable...

Answer

Altanai picture Altanai · Mar 13, 2014
  • STUN servers are used by both clients to determine their IP address as visible by the global Internet.If both the peers are behind the same NAT , STUN settings are not needed since they are anyways reachable form each other . STUN effectively comes into play when the peers are on different networks.

  • As we know that webRTC is peer to peer and the ice candidates are mandatory in webrtc. ICE functionality can be in any of the two ways , STUN and TURN .

  • There are many stun servers provided by google and other sites which one could use . You can also setup your own STUn server according to rfc5766.

Hope that gives a zest of what and how of stun .