c++ - NAT-Traversal implementation for P2P connection -


i need implement simple p2p application behind nats. should send data on reliable , secure connection (encrypted data on tcp). theoretical background know there several nat-traversal techniques (for example session traversal utilities nat) described in several rfcs (5389, 5769, , 5780).

though in practice can't find needed tools/libraries implement such system (preferably in c++ programming language). found googling around blindly: ice, turn, libnice, libjingle , stuntman

below image describes should like. have vps valid ip address, pc behind nat , sensor behind nat. have private ips. want sensor connect server, find monitor , send connection request it. after connection establishment, relay server should not used direct traffic of data. want sensor , monitor use path communicate:

sensor <--> ap0 <--> r3 <--> {the internet} <--> r2 <--> monitor 

currently data transmitted through vps:

sensor <--> ap0 <--> r3 <--> {the internet} r1 <-->  vps <--> r1 <--> {the internet} <--> r2 <--> monitor 

network

basically, if can port forward, more of infrastructure question programming. need configure routers direct traffic public ip / port private ip / port, e.g.:

r2: port 500 - tcp -> laptop-pt - port 500 r3: ports 16000/16500 - tcp/udp -> pda-pt - port 16000/16500 

if want fancy , routers support upnp, resort library implements igd protocol (e.g., miniupnp), in order make application control port mapping. this article provides starting point sample code (although recommend robust library).


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -