Unit2
学习目标:
- how TCP set up a connection
- what TCP segment looks like
- how can TCP be in high performance
- detect errors
- Finite State Machine, a basic tools and approach to network protocol design
2.1 The TCP service model
- Transmission Control Protocol(TCP)
- connection:
- two-way communication channel
- A -> B
- B -> A
- at both ends of the connection, TCP keeps a state machine to keep track of how the connection is doing
- Connection setup: 3-way hadnshake
- SYN:
- 方向:A向B
- A request conn with B
- SYN + ACK:
- 方向:B向A
- SYN:B request conn with A
- ACK: B agree to conn with A
- ACK:
- 方向:A向B
- A agree to conn with B
- Data trasmission
- stream of bytes service
- using TCP segments
- Connection teardown
- closing the connection and both ends can clean up the state associated with the state machine
- FIN:
- (Data+) ACK:
- FIN:
- ACK:
The TCP service model
Stream of bytes |
Reliable delivery service |
Reliable delivery: 4 mechanism for reliability |
1. Acknowledgments indicate correct delivery 2. Checksums detect corrupted data 3. Sequence numbers detect missing data 4. Flow-control prevents overrunning receiver |
In-sequence |
Data delivered to application in sequence transmitted. |
Congestion Control |
Controls network congestions |
- The TCP Segment Format

- The Unique ID of the TCP connection
- 104-bit globally unique ID(Internet wide)
- IP:
- IP Dest Addr
- IP Src Addr
- Protocol ID
- TCP:
- Dest Port
- Src Port
- Host A increments source port for every new connection: unique source port number(16bits)
- TCP picks random ISN(Initial Sequence Number) to avoid overlap with previous connection with same ID
- Sequence Numbers
- ISN(initial sequence number): 表明发送的第一个字节的序列号
- Ack sequence number:
- 表明下一个期待的字节的序列号
- 表明已经接受到的字节数
- Summary
- TCP provides in-order, reliable delivery of a stream of bytes between application processes.
cs244a-Introduction to Computer Networking-Unit2
原文:https://www.cnblogs.com/Willendless/p/11884355.html