Chinaunix首页 | 论坛 | 博客
  • 博客访问: 534266
  • 博文数量: 103
  • 博客积分: 2024
  • 博客等级: 上尉
  • 技术积分: 1294
  • 用 户 组: 普通用户
  • 注册时间: 2010-01-08 21:17
文章分类

全部博文(103)

文章存档

2012年(2)

2011年(21)

2010年(80)

分类:

2010-08-24 14:09:40

TCP: avoid to send keepalive probes if receiving data

RFC 1122 says the following:
...
Keep-alive packets MUST only be sent when no data or
acknowledgement packets have been received for the
connection within an interval.
...

The acknowledgement packet is reseting the keepalive
timer but the data packet isn't. This patch fixes it by
checking the timestamp of the last received data packet
too when the keepalive timer expires.

the test is easy,just using a server recieving the msg and send nothing but acks,
but in fact no keep-alive packets is send.By default this feather should be set using
setsockopt():
setsockopt($Client, SOL_SOCKET, SO_KEEPALIVE, pack("l", 1))|| warn "setsockopt: $!";
setsockopt($Client, $proto, TCP_KEEPIDLE, pack("l", 40)) || warn "setsockopt: $!";
setsockopt($Client, $proto, TCP_KEEPCNT, pack("l", 6)) || warn "setsockopt: $!";
setsockopt($Client, $proto, TCP_KEEPINTVL, pack("l", 5)) || warn "setsockopt: $!";
the first set it on,and the following set when,num and intervals on TCP-level.
阅读(1583) | 评论(0) | 转发(0) |
0

上一篇:RTO-WAR test

下一篇:e1000 issue

给主人留下些什么吧!~~