The I and small partners to share the transport layer of the network in seven, I will be divided into the following steps for everyone decomposition Description:
1.TCP protocol describes
2.TCP packet format
3.TCP three-way handshake
4.TCP four handshake
5.UDP protocol describes
6. common protocol and port
And a UDP protocol .TCP
1.TCP is connection-oriented, reliable protocol process to process communication
2.TCP provide full duplex service, i.e., at the same time data can be bidirectional transmission
3.TCP segment (up to 1500 characters Festival, 1.5kb)
- The TCP packet a plurality of bytes is called segment (Segment)
- TCP packet is encapsulated in an IP datagram
TCP segment:
1. Source port number (16)
(16) 2. The destination port number
3. The number (32): the transmitting side for each byte are numbered for the convenience of correct recombinant
4. acknowledgment number (32): a confirmation information transmitting terminal
5. the header length (4)
6 reserved (. 6)
7.URG (bit urgent pointer): 1 represents is turned on, 0 for off is not necessary after the buffer layer is directly submitted to the application, for example as follows:
after all of the data sent from the b end then the two machines a and b respectively have a cache, this time a to b will first transmit data originally acetate buffer, transport to the application layer buffer
8.ACK (acknowledgment): acknowledge bit
(quickly receive transmitted to the application layer) 9.PSH: 1 followed by the representative open, is 0 for off, to go through the cache, and a number of segments directly attendance transmitting the application layer, no queuing
10.RST (resend connection): reset bit
11.SYN (request to establish a connection flag): 1 for establishing a connection,
12.FIN (disconnection request flag):
13. window size ( 16): the number of data segments for explaining the local may receive , The window size is variable, the larger the faster the transmission window
14. Checksum (16): error checking
15. Urgent Pointer (16)
16. options: Option
two .TCP establishment of a connection establishment process is three handshake: (important)
example: At this point we have a client PC1 / PC2 server
process is as follows:- PC1 transmits a connection request SYN
- After receiving ACK PC2 will send confirmation, and sends a connection request SYN (bidirectional exchange)
- PC1 transmits acknowledgment ACK
三.TCP断开连接的四次握手:(重要)
举例:此时我们有客户端PC1/服务端PC2
具体过程如下:
- PC1发送FIN断开连接请求,并发送ACK确认位
- PC2加以确认ACK
- PC2发送FIN断开连接请求,和ACK确认位请求
- PC1发送ACK确认位
但是这里需要注意的是在TCP断开连接过程中,有一个半关闭的概念。TCP一方可以终止发送数据,但仍然可以接收数据,称为半关闭。
此处我们举例说明例如:迅雷下载东西,在页面点击下载之后使用迅雷下载,此时退出页面之后迅雷仍会继续下载
具体过程如下: - PC1客户端发送FIN报文段,半关闭此连接
- PC2服务器发送ACK报文段接受半关闭,然后继续发送数据,而客户端只发送ACK确认,不再发送任何数据
- PC2服务器把数据都发送完成时,就发送FIN报文段,
- PC1发送ACK报文段,这样就关闭了连接
常用的TCP端口号及其功能:
我们来分别说一下各个端口表示的含义:
- 21端口:FTP(20端口,数据连接/21端口,控制连接)
- 23端口:TELNET:明文访问
- 22端口:SSH:密文访问
- 25端口SMTP:服务器开放的端口,用于发送邮件
- 80端口:HTTP:超文本传输协议
- 443端口:HTTPS:安全传输协议
- 110端口:POP3,用于邮件的接收
- 143端口:IAMP4:用于邮件的接收
- 53端口:DNS
四.UDP协议:
1.无连接、不可靠的传输协议
2.花费的开销小
UDP报文的首部格式:
UDP长度:用来指出UDP的总长度,为首部加上数据
校验和:用来完成对UDP数据的差错校验,它是UDP协议提供的唯一可靠机制
常用的UDP端口号及其功能:
These are the specific transport layer protocol process related presentations and important TCP three-way and four-way handshake, there are some common ports and corresponding to the representative of the meaning, thank you!