- TCP is connection-oriented, UDP is connectionless
- UDP program structure is simple
- TCP is byte-oriented, UDP is based on datagrams
- TCP guarantees data accuracy, UDP may lose packets
- TCP guarantees data order, UDP does not guarantee
Uppercase ACK is an acknowledgment (Acknowledgement), 1 is to confirm the connection.
Lowercase ack is the Acknowledgement Number (Acknowledgement Number), that is, the last received seq from the remote host and then +1
Both the client and the server have their own seq, and each request is incremented by one in their last seq request
Uppercase ACK is an acknowledgment (Acknowledgement), 1 is to confirm the connection.
Lowercase ack is the Acknowledgement Number (Acknowledgement Number), that is, the last received seq from the remote host and then +1;
There are client C and server S (in listening state)
First request: In the data packet sent by the client, the SYN synchronization bit is 1, and the initial seq sequence number is a certain value x. At this time, the tcp client process enters the state of SYN-SENT (synchronization has been sent).
The second request: After the server sends the data packet, set both SYN and ACK to 1, the confirmation number ack is x + 1, and at the same time choose an initial sequence number of y, send data to the client, the tcp server enters SYN-RCVD (synchronously received) status.
The third request: after receiving it, the client must confirm with the server, the ACK of the confirmation segment is set to 1, the confirmation number ack = y + 1, and its own sequence number seq = x + 1. The TCP connection has been established and A enters the ESTABLISHED state. When B receives the confirmation from A, he also enters the ESTABLISHED state.