Our application connects to a device on a radio network. The network has to wake up the device before it can communicate which takes about 3 seconds. In this 3 seconds our CentOS (Linux 3.10.0-957.62.1.el7.x86_64 x86_64) machines sends 2 retransmissions of the TCP SYN packet. The retransmission cause problems on the radio network so I'd like to wait with retransmissions for at least 3 seconds.
Lowering tcp_syn_retries
doesn't really change the first retries and gives unwanted behavior when configured below 4 (which is also not advised). It just reduces retries but still follows the same pattern of retries (just less of them).
Setting tcp_frto
to 1
and setting tcp_low_latency
to 1
did not have the desired effect.
A similar question for Windows is posted here
How do I change the TCP SYN retransmission schema on Linux?
Best Answer
The tcp retransmission of the syn is related with the receive timeout (
rto
) value (see the source code). By default it equals 1 second (defined here and here; min = 0.2 sec, max = 120 sec).You can change the rto value for specified route with
ip
util.But the application itself can change the rto value with the setsockopt call.