我遇到的情况是Linux客户端正在使用UDP套接字。客户端正在发送消息,如果10秒钟内没有响应,则客户端将以10秒钟的间隔重试。
情况是,当连接断开时,客户端发送了许多试用,同时服务器端未收到任何消息。一旦建立连接,我发现所有先前的消息都在服务器上同时接收到,这意味着该消息已被缓冲,并且由于在服务器端的同一时间接收到重复的消息而导致了很多问题。
TCPDUMP在客户端:
21:01:14.691903 IP 172.123.13211 > 172.34.13211: length 88 "1st at second 14"
21:01:24.692791 IP 172.123.13211 > 172.34.13211: length 88 "2nd at second 24"
21:01:34.694930 IP 172.123.13211 > 172.34.13211: length 88 "3rd at second 34"
21:01:44.696020 IP 172.123.13211 > 172.34.13211: length 88 "4th ate second 44"
连接建立后,服务器TCPDUMP:
12:02:01.509518 IP 172.123.13211 > 13211: length 88 "Received 1st at second 1"
12:02:01.517841 IP 172.123.13211 > 13211: length 88 "Received 2nd at second 1"
12:02:01.543759 IP 172.123.13211 > 13211 length 88 "Received 3rd at second 1"
12:02:01.550741 IP 13211 > 172.123.13211: length 36
12:02:01.567948 IP 172.123.13211 > .13211: length 88
我需要了解使用UDP套接字并且连接断开的情况。 如何避免短缺时缓冲数据包
客户端代码使用C ++ 谢谢
答案 0 :(得分:0)