ROS: 将接收端的接收函数注释掉,TCP只发送,不接受数据时的recv-Q和send-Q长度实验
在上一篇博客的基础上,将ROS接收端的接收函数注释掉,使得tcp连接只发数据,不收数据。这种情况下,接收端的接收缓冲区被填满后,发送端不再发送数据包。
1.在接收端发起connect, 发送端接收连接accept以后,接收队列和发送队列的长度都为0。
2.在发送端开始send数据,但接收端不进行接收时,此时的两个队列的长度为:
发送队列:5MB的数据在发送队列里,还未被发送。
[root@cmm02node06 ~]# netstat -en|grep 192.168.250.141|grep -v ":22"|awk '{print $4,$3/1024/1024}' 192.168.250.146:3353 4.97684 192.168.250.146:3339 5.01826 192.168.250.146:3340 4.9147 192.168.250.146:3346 5.03345 192.168.250.146:3337 4.92022 192.168.250.146:3348 5.03345 192.168.250.146:3349 4.97684 192.168.250.146:3347 4.89812 192.168.250.146:3344 4.84703 192.168.250.146:3350 4.96165 192.168.250.146:3345 4.86774 192.168.250.146:3335 4.92436 192.168.250.146:3356 4.90917 192.168.250.146:3355 4.8346 192.168.250.146:3334 4.84427 192.168.250.146:3354 4.89812 192.168.250.146:3342 4.91055 192.168.250.146:3333 4.80008 192.168.250.146:3341 4.90917 192.168.250.146:3343 5.03622 192.168.250.146:3352 5.03345 192.168.250.146:3338 4.90641 192.168.250.146:3351 5.03345 192.168.250.146:3336 4.92712
接收队列:ROS不读取数据,接收队列达到最大值7.8MB。
[lhaaso@cmm02node01 ~]$ netstat -en|grep 192.168.250.146|grep -v ":22"|awk '{print $5,$2/1024/1024}' 192.168.250.146:3343 7.78206 192.168.250.146:3347 7.78064 192.168.250.146:3333 7.78502 192.168.250.146:3352 7.78135 192.168.250.146:3335 7.7763 192.168.250.146:3346 7.79125 192.168.250.146:3354 7.78007 192.168.250.146:3355 7.77478 192.168.250.146:3337 7.77435 192.168.250.146:3338 7.77963 192.168.250.146:3336 7.7764 192.168.250.146:3351 7.7793 192.168.250.146:3341 7.79034 192.168.250.146:3342 7.78549 192.168.250.146:3344 7.77346 192.168.250.146:3339 7.79449 192.168.250.146:3349 7.78121 192.168.250.146:3350 7.78054 192.168.250.146:3340 7.77515 192.168.250.146:3353 7.7793 192.168.250.146:3345 7.78344 192.168.250.146:3334 7.78043 192.168.250.146:3356 7.78896 192.168.250.146:3348 7.78344
在发送端抓包发现,最后收到的一个从接收端来的ack的确认序列为 8171665 ,
8171665/1024.0/1024.0=7.8MB
即发送方发了7.8MB到接收方的接收缓冲区,接收方全都收到了,并返回ack给发送方,发送方也收到了确认序列号为7.8MB的ack。
13:27:24.758482 IP 192.168.250.141.51385 > 192.168.250.146.3333: Flags [.], ack 8155737, win 1, options [nop,nop,TS val 3046956923 ecr 3046745726], length 0 13:27:24.799490 IP 192.168.250.141.51385 > 192.168.250.146.3333: Flags [.], ack 8171665, win 1, options [nop,nop,TS val 3046956964 ecr 3046745773], length 0
所以发送队列里的5MB长度,全都是发送队列里没有被发送的数据长度。