How does peer2peer work through a router?

2019-02-07 09:52发布

How does one PC connect to another over the internet to another PC?

An example would be a program listening for connections on PC 1. PC 1 sits behind Router 1. PC 2 has a client program trying to connect to PC 1.

What is the correct technology/technique to use as the listening program in this situation?

2条回答
Root(大扎)
2楼-- · 2019-02-07 09:57

You may want to read up on NAT Traversal. NAT traversal is a general term for techniques that establish and maintain TCP/IP network connections traversing network address translation (NAT) gateways.

查看更多
霸刀☆藐视天下
3楼-- · 2019-02-07 10:19

This article by Brian Ford explains how peer to peer communication across NATs work.

Most routers also expose a Universal Plug and Play interface (uPnP) which can be used for port forwarding and NAT traversal.

You should also check out the STUNT library which is an easy to use NAT traversal library.

查看更多
登录 后发表回答