https://github.com/bakwc/udt-nat-traverse
Example of nat traversal using udt library. UDT is a udp based connection establishing protocol.
- server.cpp - waiting for two clients, send them their addresses
- client.cpp - connects to server, wait for other client address, connects to other client
#include <arpa/inet.h> #include <udt.h> #include <iostream> #include <cstring> using namespace std; int main() { UDTSOCKET serv = UDT::socket(AF_INET, SOCK_STREAM, 0); sockaddr_in my_addr; my_addr.sin_family = AF_INET; my_addr.sin_port = htons(6890); my_addr.sin_addr.s_addr = INADDR_ANY; memset(&(my_addr.sin_zero), '