4
votes

I've read that ICE is an agent on the WebRTC server which sends SDP information of users to STUN or TURN server.
STUN and TURN server gives this SDP information and makes a P2P connection for the users.

Is that true?
So, what is the exact difference between STUN and TURN server?
If the ICE agent configured with a TURN server, what would be happened with data flow? in this instance, TURN just act as a datagram-forwarder?

1
note that neither the STUN nor the TURN server deal with SDP. That is the job of the signaling server. - Philipp Hancke
@PhilippHancke What do you mean by "That is the job of the signaling server"? Which part of the signaling server? - M. Rostami
your questions sounds like you are confusing teh STUN and signaling servers (which is quite a common confusion). The STUN server aids in the discovery of a public ip, the signaling server exchanges SDP and ice candidates (the latter are gathered from STUN and/or TURN servers) - Philipp Hancke

1 Answers

20
votes

TURN is a relay — both clients send data to the TURN server, which forwards it to the other client.

STUN is not a relay — the STUN server helps to "make the connection" between the clients (by discovering and exchanging their external host:port pairs), after which they send data to each other directly. However, STUN doesn't work with all NAT/firewall setups, so TURN is used when STUN fails.