TCP simultaneous open and self connect prevention

后端 未结 9 845
长情又很酷
长情又很酷 2020-12-08 11:54

TCP standard has \"simultaneous open\" feature.

The implication of the feature, client trying to connect to local port, when the port is from ephemeral range, can o

9条回答
  •  情书的邮戳
    2020-12-08 12:21

    In my opinion, this is a bug in the TCP spec; listening sockets shouldn't be able to send unsolicited SYNs, and receiving a SYN (rather than a SYN+ACK) after you've sent one should be illegal and result in a reset, which would quickly let the client close the unluckily-chosen local port. But nobody asked for my opinion ;)

    As you say, the obvious answer is not to listen in the ephemeral port range. Another solution, if you know you'll be connecting to a local machine, is to design your protocol so that the server sends the first message, and have a short timeout on the client side for receiving that message.

提交回复
热议问题