TCP IP knowledge carding

 

  1. Why do you need TCP protocol? What level do you work on?
    1. Need to guarantee the reliable, orderly and complete package delivery, so there is TCP protocol
    2. The IP layer is unreliable, so at the transport layer
  2. What is a TCP connection
    1. Connection-oriented (one-to-one), reliable, byte stream (borderless, ordered)
  3. How to uniquely determine a TCP connection
    1. Source address + port, destination address + port determine a unique connection
  4. Differences and application scenarios of TCP UDP
    1. From a connection point of view, TCP first establishes a connection before transmitting, and UDP directly transmits
    2. From the object point of view, TCP one-to-one transmission, UDP one-to-many (one-to-one, many to many)
    3. From a reliable point of view, TCP is delivered reliably, and UDP delivery is not guaranteed
    4. From the perspective of congestion and flow control, TCP has congestion control and flow control, UDP does not
    5. From the perspective of header overhead, TCP is long and variable, and UDP is fixed at eight bytes
      1. Application scenarios: TCP (FTP, HTTP, etc.) UDP (video, audio, broadcast communication)
  5. Three handshake
    1. Client sends (initiates a connection to the server)
    2. Received by the server and sent back a "confirmation response"
    3. The client sends it to the established state, and the server side becomes the established state after receiving it (only data can be sent this time, not the first two times because it is established)
  6. Why three handshake
    1. Avoid historical connections (assuming that an old message arrives at the server before the new message, the server returns, and the old message received by the client can be found to be an expired message, and then send RST to terminate the connection, and if it is Twice, this connection is established, it is ridiculous)
    2. Synchronous initial serial number
    3. To avoid waste of resources (new and old SYN packets arrive one after another, if the second handshake will cause multiple connections to be established)
  7. What is the fourth wave
    1. The client intends to close, send the closed FIN_WAIT_1 message
    2. The server sends an ACK response message and enters the CLOSED_WAIT state
    3. The client enters the FIN_WAIT2 state after receiving
    4. After the server processes the data, it sends FIN to the client
    5. After the client receives, return ACK
    6. After the server received it, it closed
    7. Finally, after the client waits for 2MSL, it is also closed
  8. Why do you need to wave four times
    1. When closing the connection, the client does not send, but to receive data
    2. After the server returns the ACK, there may be data to be sent and processed. After sending the data, send FIN
  9. The reason why TIME_WAIT time is 2MSL
    1. 1MSL is the maximum survival time of a message
    2. But there may be a message from the sender in Wanluo, and the receiver needs to respond and return, 2MSL
  10. Reason for the existence of TIME_WAIT
    1. Prevent the data packet of the old connection (the data of the old connection, because the TIME_WAIT time is too short, the second connection starts, he was received, outrageous)
    2. Ensure the correct closing of the connection (wait for enough time to ensure that the last ACK can be received by the passive closing party to help it close normally)
  11. to be continued

Guess you like

Origin www.cnblogs.com/tillnight1996/p/12741302.html