This simple program shows an example of NAT Hole Punching between 2 peers over UDP. Repository contains implementations of client side and server (Rendezvous) side. In the beginning of communication clients send their local ips to Rendezvous. Then Rendezvous server sends pairs <local_peer_addr, global_peer_addr> back to peers. After clients received their peer address pair, they try to find out by which address the peer would respond. After one of ips is confirmed, connection could be established.
Compiling (you must have boost_program_options installed):
make server # build Rendezvous
make client # build client Then start Rendezvous server and clients (in different terminal windows) (order is important!).
Start Rendezvous server:
./Server.o --addr [rendezvous ip addr] --port [rendezvous port]Start first client (type A):
./Client.o --type A --c-addr [local_machine ip addr] --c-port [local_machine port] --s-addr [rendezvous ip addr] --s-port [rendezvous port]Start second client (type B):
./Client.o --type B --c-addr [local_machine ip addr] --c-port [local_machine port] --s-addr [rendezvous ip addr] --s-port [rendezvous port]It is an educational task for computer networks course at MIPT.