"TCP/IP Detailed Volume 2: implementation" NOTE--tcp input (cont.)

Source: Internet
Author: User

This article handles the ACK flag, updates the window information, processes the URG flag and all the data that is carried in the message segment, and finally processes the FIN flag and, if necessary, calls

Tcp_output.

1. Complete passive open and open simultaneously

This section describes how to handle the ACK message segments received in the Syn_rcvdz state. This will also complete the passive open, or the simultaneous open and self-connected connection is established

Process.

1. Verify the Received ACK.

2. view window size options.

3. Submit the data in the queue to the application process.


2. Fast retransmission and fast recovery algorithm for fast re-transmission algorithm for a number of consecutive (typically 3) repeated ACK, TCP believes that a message has been lost and inferred from the missing message segment start sequence, the loss of the message segment is re-transmitted. This algorithm is mentioned in RFC 1122, and it is recommended that TCP send an ACK immediately after receiving a sequence of scrambled packets. The fast recovery algorithm thinks that after the fast retransmission algorithm (that is, the lost message segment has been re-transmitted), the congestion avoidance algorithm should be implemented instead of slow start. This way, if the congestion is not serious, it can also guarantee a large throughput, especially when the window is large. NET/3 also realizes fast retransmission and fast recovery algorithm.
3.ACK processing continues to process the ACK below. 1. Adjust the congestion window. 2. Check the validity of the ACK. 3. Calculate the number of bytes confirmed. 4. Update the RTT calculation value. 5. Have you confirmed all sent data? 6. There are unconfirmed data. 7. Update the Congestion window. 8. Delete the confirmed bytes from the send cache. 9. Wake up the process waiting to send the cache. 10. An ACK was received while in the Fin_wait_1 state. 11. Set the fin_wait_2 timer. 12. An ACK was received in the closing state. 13. The ACK is received in the Last_ack state. 14. An ACK was received in the TIME_WAIT state.
4. Update the window information 1. If you need to update the Send window. 2. Update the variables.

5. Emergency processing the next part of the TCP input processing is the message segment when the URG flag is placed. 1. Whether or not to deal with Urg representations. 2. Ignore the excess emergency pointers. 3. Calculate the received emergency pointers. 4. Advertise the emergency mode of TCP to the application process. 5. Extract out-of-band data from normal data streams. 6. If not in emergency mode, adjust the receiving emergency pointer.

6. Processing the received data Tcp_input then extracts the received data (if present), adds it to the socket receive cache, or puts it in a disorderly-ordered reorganization queue of the socket.

7.FIN handles the next step of Tcp_input, handling the FIN flag. 1. Process the first fin received. If the receiving segment fin is set and is the first fin received on the connection, an ACK is sent immediately. 2.SYN_RCVD and established states. If the connection is with the SYN_RCVD and established states, the new status is close_wait.3.fin_wait_1 after the FIN is received. Because the ACK processing of the message segment has ended, if the connection is in the Fin_wait_1 state when the fin is processed, it means that both ends of the connection are closed simultaneously---the two fin sent at both ends is interleaved across the network. The connection enters the closing state. 4.fin_wait_2 status. Receiving fin will bring the connection into the TIME_WAIT state. When the Fin_wait_1 state receives a segment with an ACK and fin, although the connection is transferred directly from Fin_wait_1 to the TIME_WAIT state, the connection actually enters the fin_wait_2 state when the ACK is processed. The fin processing here then transfers the connection to the TIME_WAIT state. Because the ACK is processed before FN, the connection always passes through the fin_wait_2 state, albeit briefly. 5. Start the time_wait timer. 6.time_wait status. If you receive fin in the TIME_WAIT state, this is a repeating message segment, starting the time_wait timer, which is equal to twice times the MSL.
8. Final treatment 1. So_debug socket option. If the so_debug socket option is selected, records are added to the ring buffer of the kernel. 2. Call Tcp_output. 3.dropafterack. 4.dropwithreset. The sequence number and confirmation number of the 5.RST message segment. 6. Reject the connection. 7. Release the temporarily created socket. 8. Discard (without ACK or RST)

"TCP/IP Detailed Volume 2: implementation" NOTE--tcp input (cont.)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.