TCP的重传

最近在做TCP相关的分析, 在设计重传检测时,对于重传的具体规定有点犯糊涂了,RFC793是这么描述的:When the TCP transmits a segment containing data, it puts a copy on a retransmission queue and starts a timer; when the acknowledgment for that data is received, the segment is deleted from the queue.  If the acknowledgment is not received before the timer runs out, the segment is retransmitted. RFC里只简单地说segment需要被重传,如何重传呢?重传报文是否一定要于原报文完全一致呢?是否可以多个报文组成一个大报文重传呢?还是可以split成多个?重传的边界是否必须是和原报文一致呢?

       这些问题的答案严重影响设计的复杂程度,在网上搜索了一通,无果,于是发了条短信给以前的同事,呵呵,讨论了半天,也没得出确定的结论。今天又看了一下《TCP/IP Illustrated, Volume 1, The Protocols》,在21章居然提到了这个问题,“When TCP times out and retransmits, it does not have to retransmit the identical segment again. Instead, TCP is allowed to perform repacketization, sending a bigger segment, which can increase performance. (Naturally, this bigger segment cannot exceed the MSS announced by the other receiver.) This is allowed in the protocol because TCP identifies the data being sent and acknowledged by its byte number, not its segment number.” 所以说重传报文完全没有必要和原报文一致,是可以把多个报文重组为一个大的报文进行重传的。

       在网上下载了一个开源的TCP/IP协议栈 (http://sics.se/~sdam/lwip/), 研究了一下TCP的实现,因为TCP是基于字节流的,所以很自然就可以处理传输过程中出现的边界不对齐,一个报文分为多个处理,多个报文合并为一个等等情况,看来这些情况都是有可能出现,要做一个健壮的设计,这些情况都应该能够处理。

       一直以为自己对TCP协议还是比较了解的,结果发现一个重传问题都搞不定,关于TCP的RFC那么多,我一个都没有完整看过。今天翻看《TCP/IP Illustrated, Volume 1, The Protocols》时,发现不少知识点已经有点不认识我了,唉,看来还是应该扎扎实实多看点书地。。。
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Wireshark是一款网络分析工具,可以用于分析TCP重传。通过Wireshark,你可以捕获网络数据包,并查看每个数据包的详细信息。在Wireshark的Packet List面板中,你可以观察到重传报文,它们通常以黑色背景和红色字体呈现。通过查看报文的SEQ/ACK Analysis截面,你可以确定是否是快速重传帧。快速重传TCP错误恢复功能的一种情况,它指的是当接收方收到重复的ACK时,会立即重传丢失的报文段,以加快数据传输速度。通过分析Wireshark捕获的数据包,你可以识别和诊断网络慢速问题,并对网络各组成部分上的数据流进行概况分析,以帮助解决网络性能问题。\[1\]\[2\]\[3\] #### 引用[.reference_title] - *1* [网络基本功(二十四):Wireshark抓包实例分析TCP重传](https://blog.csdn.net/mxway/article/details/44261633)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* *3* [Wireshark(四):网络性能排查之TCP重传与重复ACK](https://blog.csdn.net/maimang1001/article/details/120266544)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值