TCP and UDP
One, TCP and UDP protocol
The
transmission layer protocol of the TCP/IP protocol family TCP (Transmission Control Protocol) Transmission Control Protocol
UDP (User Datagram Protocol)
TCP Protocol: Transmission Control Protocol, stable and reliable transmission
TCP is connection-oriented, reliable process-to-process communication TCP provides full-duplex service, that is, data can be transmitted in both directions at the same time. Each TCP has a sending buffer and a receiving buffer to store data temporarily.
UDP protocol: user datagram protocol, higher transmission efficiency
UDP protocol is a connectionless, reliable transport layer protocol. The sender does not care whether the sent data arrives at the target host, whether the data is wrong, etc. The host receiving the data will not tell the sender whether it has received the data. Its reliability is guaranteed by the upper layer protocol. Transfer data faster and more efficiently.
The connection-oriented network protocol refers to the establishment of a connection between the two parties before communication. For example, when making a call, the two parties need to establish a connection before making a call.
The connectionless network protocol means that the communication parties do not need to establish a communication line in advance, but send each packet with the destination address to the network line, and the system independently selects the route for transmission. For example, qq, WeChat sends information.
6 control bits:
URG: emergency bit, emergency pointer valid bit
ACK: confirmation bit, only when ACK=1, the confirmation sequence number field is valid, when ACK=0, the confirmation is invalid
PSH: urgent bit, PSH=1, required The receiver sends the data segment to the application layer as soon as possible.
RST: reset bit, RST=1, notify to re-establish TCP connection
SYN: synchronization bit, (connection bit) synchronization sequence number bit tcp SYN=1 when a connection needs to be established
FIN: disconnect Bit, when TCP completes data transmission and needs to disconnect, the party that proposes to disconnect will set FIN=1
Two, TCP connection and disconnection
1. The process of TCP establishing a connection is called a three-way handshake
2. The process of TCP disconnection waved four times
ssh port 22
TCP commonly used port numbers and functions
21 FTP | Control port opened by the FTP server |
---|---|
23 telnet | Used for remote login, can remotely control and manage the target computer |
25 SMTP | The port opened by the SMTP server for sending mail |
80 HTTP | Hypertext Transfer Protocol web page service |
110 POP3 | Used for mail acceptance |
DUP commonly used ports and their functions
69 TFTP | Simple File Transfer Protocol |
---|---|
111 RPC | Remote procedure call |
123 NTP | Network time protocol |