miladrasooli miladrasooli -4 years ago 60
C# Question

Using TURN server for peer-2-peer communication

I’m very new to TURN and I want to create an experimental application which requires a TURN server for its udp communication.

I have used UDP hole punching already and I’m familiar with the subject.Also I know about NAT types and UPnP for port mapping.

To solve port mapping in Symmetric and Port restricted NATs with routers without UPnP capability I must communicate with a TURN server and send UDP packets through it.But I don’t have any idea how to communicate with TURN server and how to work with it in

C# programming.


I’d appreciate it if you could point me to the right direction and give me some pointers.

Thanks.

Answer Source

I can answer about how to use TURN for completing a relay call. But to know how to form messages for TURN you need to read the RFC.

How TURN Works

TURN is needed because its impossible to bypass some NATs filtering and establish direct connection with a host. As TURN sits on a public IP, anyone can connect with it.

So hosts under symmetric NAT can send allocation request to TURN server and TURN server will allocate a port for the host. Now the host will have IP information of the other side. And it will send another request to TURN specifying the IP info of other host and packets from that other host in the allocated port will be forwarded to the host behind the symmetric NAT. And packet from the host behind the symmetric NAT will be forwarded to the other host. This way they create a relay connection.

You really need to read the RFC for TURN to know this in more details. Everything you need is there.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download