/UDPHolepunchingDemo

Demosntrate how can you communicate between two remote machines with a STUN server. (C++, UDP socket, Linux, Windows)

Primary LanguageC++GNU General Public License v3.0GPL-3.0

UDP Holepunching demo

Alt text

Its a P2P UDP communication demo uses hole punching technology written in C++. It's working between remote machines behind the NAT or something like this. You need an address/port "share" server with public IP (there are free VPS machines, for example Google VPS) for hole punching.

How can it work?

IPv4 is quite a good technology for local network. You can just use IP address directly and it is working perfectly for the communication each other. Unfortunately IPv4 is not a useful for connect remote machine, because the machine count is bigger than all IPv4 addresses. There are a lot of technologies for IP forwarding like NAT etc. Holepunch tecnology can detect which useful IP and port pair for a client behind the NAT or switch or something like this. Two clients connect to the server (public IP, port) and the server send IP and port information to all clients. After the information sharing two clients can communicate each other without server.

How to use it

  • Run Server executable on the server what has public IP
  • Run Client executable on two remote client machines
  • Enter server address on clients
  • The server send IPs for clients
  • Two clients communicate each other