unwrap( isn, checkpoint ); uint64_t index = message.SYN ? ab_seqno : ab_seqno - 1; reassembler_.insert( index, message.payload, message.FIN ); } TCPReceiverMessage TCPReceiver::send() const { // Your code here.
return checkpoint + dis - TWO32; } 2. Implementing the TCP receiver TCPReceiver中加一个std::optional<Wrap32> isn_ {}; 主要是在stream index, abs-seqno 和 seqno之前相互转换时要注意细节 voidTCPReceiver::receive(TCPSenderMessagemessage,Reassembler&reassembler,Writer&inbound_stream){if(!isn_.has...
TCPReceiver and has a different ISN.// 将TCP协议头中携带的32位序列号转换为64位绝对序列号// 参数: 要转换的32位序列号,本次TCP连接的ISN(初始序列号),检查点(一个32位序列号对应多个64位序列号,因此这里选择靠近ISN的值)uint64_tunwrap(WrappingInt32 n,WrappingInt32 isn,uint64_t checkpoint){uint6...
and the other stream runs from the remote TCPSender to the local TCPReceiver and//! has a different ISN.uint64_tunwrap(WrappingInt32 n, WrappingInt32 isn,uint64_tcheckpoint){autooffset = n -wrap(checkpoint, isn);int64_tabs_seq = checkpoint + offset;returnabs_seq >=0? abs_seq : abs...
在Lab 1中,你创建了一个StreamReassembler,它接受一系列子字符串,所有这些子字符串都来自同一个字节流,并将它们重新组装成原始流。这些模块将在你的TCP实现中证明其有用性,但它们中没有任何一个是特定于传输控制协议(TCP)的细节。这一点在Lab 2中发生了变化,你将实现TCPReceiver,这是TCP实现的一部分,用于处理...
1在lab0中,我们实现了流控制字节流(ByteStream)的抽象。在lab1中,我们创建了一个StreamReassembler的结构体,它可以接受来自相同的字节流的子字符串序列,并将它们重新组装到原始流中。 2这些模块可以发挥作用并可以满足实验要求,但是它们并没有体现出TCP传输控制协议的细节,所以在lab2中,我们将会实现一个TCPReceiver,...
实现TCP接收器,编写tcp_receiver.cc tcp_receiver.hh文件如图3-4、3-5所示。源代码见附录。 图3-4 tcp_receiver.cc 图3-5 tcp_receiver.hh 在build 目录下输入命令"make check2" 对lab2进行检查,结果如3-6所示,可以看到所有的测试样例全部通过。
int64_t result = checkpoint + interval; if (result >= 0) return result; else return result + (1ul << 32); } 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. Implementing the TCP receiver ...
Checkpoint 2: the TCP receiver Checkpoint 3: the TCP sender Checkpoint 4: down the stack (the network interface) Checkpoint 5: building an IP router Checkpoint 6: putting it all together (optional) Checkpoint 7: measuring the Internet (optional) Lab7 ask you to write analysis about Internet ...