0

I have UDP P2P app that currently relies on at least one of the clients enabling port forwarding on their router, and sharing their public IP address with the other client.

I want to remove this constaint, and so have been reading articles pertaining to STUN, TURN, ICE, etc, and articles about hole punching such as this, which seems to be the de facto reference:

https://bford.info/pub/net/p2pnat/

I think I've have fair concept of what is involved - the server acts as a rendezvous and provides each client with the public IP address of the other, who then start communicating with each other.

But my understanding of STUN servers is that they don't provide this functionality - they only provide a client with a way to get thier own public IP address and NAT status. So, if I am correct, I cannot use a public free STUN server for hole punching, is this right?

If so, does this mean I need to write and host my own server if I want to do this? Or are there other public free servers that can act as a rendezvous for UDP hole punching in a generic/standardised way?

Tom Davies
  • 2,386
  • 3
  • 27
  • 44
  • You can get away with using STUN only and your own **signaling service** for most home NAT scenarios. STUN helps you find out what your IP/port address is so that you can tell the other node what it is through the signal service. TURN does the same thing but also provides a relay address/port to fall back on if that fails. More details here: https://stackoverflow.com/a/8524609/104458 – selbie May 19 '22 at 16:16
  • So I still need my own signalling service, right?If I don't want to rely on players having exchange IP addresses over IM etc, I'll need to make some sort of server available? – Tom Davies May 23 '22 at 10:54
  • That is correct. Some of the webrtc examples out there have this little nodejs program that functions as a signaling server. – selbie May 23 '22 at 17:36
  • Just to revist this... Having written a small and very basic lobby server for matchmaking, I'm left wondering if there's actually any need for the STUN stage? The matchmaking server by necessity is able to see the public IP/Port of all clients, and can pass this information on as needed. Or am I missing something? – Tom Davies Jun 21 '22 at 14:03

0 Answers0