Application control of TCP retransmission on Linux

前端 未结 5 1536
醉话见心
醉话见心 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

    After some thinking (and googling), I came to the conclusion that you can't change tcp_retries1 and tcp_retries2 value for a single socket unless you apply some sort of patch to the kernel. Is that feasible for you?

    Otherways, you could use TCP_KEEPALIVE socket option whose purpose is to check if a connection is still active (it seems to me that that's exactly what you are trying to achieve, so it has sense). Pay attention to the fact that you need to tweak its default parameter a little, because the default is to disconnect after about 2 hrs!!!

提交回复
热议问题