Application control of TCP retransmission on Linux

前端 未结 5 1537
醉话见心
醉话见心 2020-12-02 06:14

For the impatient:

How to change the value of /proc/sys/net/ipv4/tcp_retries2 for a single connection in Linux, using setsockopt()

5条回答
  •  执笔经年
    2020-12-02 06:22

    I suggest that if the TCP_USER_TIMEOUT socket option described by Kimvais is available, you use that. On older kernels where that socket option is not present, you could repeatedly call the SIOCOUTQ ioctl() to determine the size of the socket send queue - if the send queue doesn't decrease over your timeout period, that indicates that no ACKs have been received and you can close the socket.

提交回复
热议问题