学习的要点
- 不要追求知识的广度
- 遇到痛点,要一个一个学好
- 引出的问题:
- Q: 为什么TCP是可靠的?A: 因为有连接,
- Q: 为什么有连接就可靠,或者网络保留了一个带宽?A: 因为有握手
- Q:握手的本质是什么? A:ack
- Q:那链接有ACK保证可靠,后面呢?A:拥塞窗口,滑动窗口,ACK包
- 两个问题:
- 一个网络包是如何到达目的地的
- 对BDP、Buffer、各种窗口、rt的理解和运用
- 在摇网工之前可以做的:
- ping ip通不通,还是因为禁掉了icmp
- telnet ip port通不通?(不懂)
- 抓包,抓网络包
- 是不是都不通还是只有自己的机器不通
- 一定要学会使用tcpdump和wireshark
RFC 1180https://datatracker.ietf.org/doc/html/rfc1180#autoid-5
UDP
- When an application sends data out through UDP it arrives at the far end as a single unit.
- 5 writes of sender means 5 read of receiver
- UDP will continue to discard UDP datagrams until there is space in the queue.
- checksum
- is zero -> skip checksumming
- is not valid -> discarded
- discard data while space is not enough
- msg will be discarded by UDP if application cannot receive them as faster as they come
- UDP will discard the datagram when there is no space in the queue
TCP
- TCP guarantees delivery, whereas UDP does not.
- connection oriented byte stream, instead of connectionless datagram delivery service.
- Reliable tranmit
- These two end-point TCP modules contain state information that defines a virtual circuit.
- TCP packetizes the byte stream at will
- no correlation bettwen the number and size of writes at one end and the number and side at the other end
- sliding windows:
- with time-out and retransmits.
- The window size determines the amount of data that can be transmitted before an acknowledgement is required.