/* Flags in tp->nonagle 默认nagle算法关闭的*/ #define TCP_NAGLE_OFF 1 /* Nagle's algo is disabled */ #define TCP_NAGLE_CORK 2 /* Socket is corked */ #define TCP_NAGLE_PUSH 4 /* Cork is overridden for already queued data */
//对应time_wait, alios 增加了tcp_tw_timeout 参数可以来设置这个值,当前网络质量更好了这个值可以减小一些 #define TCP_TIMEWAIT_LEN (60*HZ) /* how long to wait to destroy TIME-WAIT * state, about 60 seconds */ #define TCP_SYN_RETRIES 6 /* This is how many retries are done * when active opening a connection. * RFC1122 says the minimum retry MUST * be at least 180secs. Nevertheless * this value is corresponding to * 63secs of retransmission with the * current initial RTO. */
#define TCP_SYNACK_RETRIES 5 /* This is how may retries are done * when passive opening a connection. * This is corresponding to 31secs of * retransmission with the current * initial RTO. */
$sudo ip route show default via 10.0.207.253 dev eth0 proto dhcp src 10.0.200.23 metric 1024 10.0.192.0/20 dev eth0 proto kernel scope link src 10.0.200.23 10.0.207.253 dev eth0 proto dhcp scope link src 10.0.200.23 metric 1024
$sudo ip route change default via 10.0.207.253 dev eth0 proto dhcp src 10.0.200.23 metric 1024 quickack 1
$sudo ip route show default via 10.0.207.253 dev eth0 proto dhcp src 10.0.200.23 metric 1024 quickack 1 10.0.192.0/20 dev eth0 proto kernel scope link src 10.0.200.23 10.0.207.253 dev eth0 proto dhcp scope link src 10.0.200.23 metric 1024
C代码中关闭的话:At the application level with the TCP_QUICKACK socket option. See man 7 tcp for further details. This option needs to be set with setsockopt() after each operation of TCP on a given socket