P2P connection between two clients that know each other's public ip's

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By punchthrough


I’m making a networked 1v1 game that is meant to use a peer to peer connection between two clients.

I know that there are several host/client examples, but I’m looking to establish a connection without having to open any ports from a firewall.

I’ve looked at doing a NAT punchthrough, and I can use a master server to inform each of the clients of the others public ip.

Which class would allow me initialize this kind of UDP connection with godot? I looked at PacketPeerUDP, but that seems to only work with a client/host style approach.

:bust_in_silhouette: Reply From: Calinou

Godot doesn’t support UDP NAT punchthrough yet, although you can use UPnP. Only WebSockets NAT punchthrough using a STUN or TURN server) can be used.

UPnP won’t work everywhere as many routers have it disabled by default for security reasons.