UDP hole Punching

后端 未结 2 1177
说谎
说谎 2021-02-09 02:37

I\'ve got some questions regarding hole punching with UDP. Based on the wiki http://en.wikipedia.org/wiki/UDP_hole_punching

1) To set up a UDP session between two partie

2条回答
  •  余生分开走
    2021-02-09 03:16

    1) Yes, with most reasonable firewalls, unless you configure it in extremely paranoid mode.

    2) Not exactly. This article explains it in more detail, but the idea is that one of the clients first sends a datagram to the other's public IP. Then this datagram is discarded, but the other client knows that it was sent because the first one told it through the server. Then the other client sends a datagram back to the first one to the same port from which the first datagram originated. Since NAT at the first client remembers that there was a packet from that port, it considers the incoming datagram to be a reply to the first one. The problem here is to figure out which public port NAT will choose to send the first datagram, but most NATs do it in a predictable way so it almost always works fine, sometimes just not from the first try.

提交回复
热议问题