How do I make a TCP server work behind a router (NAT) without any redirection configuration needed

前端 未结 4 693
孤独总比滥情好
孤独总比滥情好 2020-12-09 11:34

The scenario is the following. I have two machines A and B: A: Client (behind NAT) B: Server (behind NAT)

I want B to be able to listen on any given port, so that A

4条回答
  •  情深已故
    2020-12-09 12:25

    An alternative to a proxy server is a match-making server. Instead of proxying all of the traffic, the match maker just negotiates until the peers can talk to each other. This involves finding the external public IPs of the peers and talking to each one so that the firewall/router knows that the peers wish to communicate.

    This is called hole punching and it often has to be done by the match maker rather than the peers themselves. Once the hole are punched though, the match maker can tell the peers about each other and they can communicate directly.

提交回复
热议问题