Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 6 years ago.
I am programming linux device driver over a very slow interface, whose ping round time can be as long as several minutes. When I try to use TCP to establish connection between two nodes the connection always times out.
Is there a method to set the TCP retransmission or handshaking timeout longer in the driver, or are there any commands to set it with? Thanks
Have you tried searching for an answer to this question? A quick Google search gave me this, which appears to directly address this issue. The summary is that the setting of the net.ipv4.tcp_syn_retries
determines that maximum timeout available to TCP connections.
If that document doesn't answer your question, you should indicate what you tried and how the behavior differed from what you expected.
/proc/sys/net/ipv4/tcp_retries1
/proc/sys/net/ipv4/tcp_retries2
.
tcp_retries1 - INTEGER
This value influences the time, after which TCP decides, that
something is wrong due to unacknowledged RTO retransmissions,
and reports this suspicion to the network layer.
See tcp_retries2 for more details.
RFC 1122 recommends at least 3 retransmissions, which is the
default.
tcp_retries2 - INTEGER
This value influences the timeout of an alive TCP connection,
when RTO retransmissions remain unacknowledged.
Given a value of N, a hypothetical TCP connection following
exponential backoff with an initial RTO of TCP_RTO_MIN would
retransmit N times before killing the connection at the (N+1)th RTO.
The default value of 15 yields a hypothetical timeout of 924.6
seconds and is a lower bound for the effective timeout.
TCP will effectively time out at the first RTO which exceeds the
hypothetical timeout.
RFC 1122 recommends at least 100 seconds for the timeout,
which corresponds to a value of at least 8.