Network knowledge consolidation

1. http1.0 and the difference http1.1

http stateless protocol, each request is independent of each other, each stage thus finished http1.0 closes the connection request.

In order to reduce the same to establish a connection takes time to destroy a connection, the socket multiplexing HTTP1.0 added, so that multiple requests may be used. In HTTP / 1.0 the keep-alive protocol is not standard, the client must send Connection: Keep-Alive to activate the connection keep-alive

1) stay connected: reducing connection time and destroy connections (keepalive are enabled by default after HTTP1.1, even without keepalive parameters)

2) the pipeline mode: the client can then send a new HTTP request message before receiving a response packet

Wherein the tcp: reliable connection-oriented transport

TCP protocol to ensure data transmission reliability ways are:

  • Checksum
  • The serial number and the acknowledgment
  • Retransmission timeout
  • Connection Management
  • flow control
  • Congestion Control

tcp packet format

 

tcp packet flags What?

Flag: a total of six, i.e. URG, ACK, PSH, RST, SYN, FIN , and specific meanings are as follows:
                (A) the URG: Urgent Pointer (urgent pointer) effective.
                (B) ACK: acknowledgment number is valid.
                (C) PSH: recipient should be the message to the application layer as soon as possible.
                (D) RST: reset the connection.
                (E) SYN: initiate a new connection.
                (F) FIN: releasing a connection.

SYN packets and FIN packets are one byte

How to build and release tcp link:

Three tcp handshake flow chart

 

 Why do we need three-way handshake?

In order to prevent harassment SYN packet network server failure. eg: Suppose a client sends a SYN packet, for some reason lost, after the client retransmission timeout, establish a connection and disconnect after sending data, lost SYN packet finally found a client, if only two handshake, the server will be lost because of the SYN with the client to establish a connection, but in fact do not need this link, when a large network delay time, the server will maintain links many of these do not need, resulting in excessive resource consumption.

When the server is in SYN_RCVD state, the client hang what will happen? Retransmission timeout

Four wave:

 

 

How to implement TCP flow control?

Using a sliding window, each window size of the TCP header field indicates the size of the receiving end available buffer space, in bytes. The field length is 16 bits. Each time an ACK packet back to the receiver will indicate the size of the window, the window refers to the sender to the recipient can send a maximum number of bytes in the case did not receive ACK, that left the value of the window is the latest sender received ACK ACK packet sequence number, window size packet window field value.

Initiate shut down the party after sending the last packet Why wait some time before the close link? How long is the waiting time?

The waiting time is 2 times the MSL (maximum segment lifetime, indicate a TCP packet longest survival time on the Internet). There are two roles 1. To prevent the other party did not receive a final confirmation packet can be retransmitted packets time out 2. Clean the network retention, to prevent harassment server packets get lost.

How tcp congestion control?

 

A host B to host a message of what the process is like?

 

Reference blog:

https://www.cnblogs.com/Qing-840/p/9283367.html

https://blog.csdn.net/liuchenxia8/article/details/80428157

 

Guess you like

Origin www.cnblogs.com/catpainter/p/12452610.html