TCP Shutdown/close on Linux

Source: Internet
Author: User

TCP shutdown/close on LinuxThe Linux version is kernel-2.6.21:1. As long as there is unread (read) data in the read buffer of the TCP stack, the RST is sent directly to the peer when close is called. 2.shutdown does not have a relationship with the socket descriptor, even if the call to shutdown (FD, SHUT_RDWR) does not close the FD, and eventually close (FD) is required. 3. Shutdown (FD, SHUT_RD) can be considered an empty operation, since shutdown can continue to read data from the socket, which may require further confirmation. 4. Write the socket descriptor after the fin package has been sent raises epipe/sigpipe. 5. When multiple socket descriptors point to the same socket object, when close is called, the reference count of the object is decremented first, and the FIN packet end TCP connection is not sent until 0 o'clock. Shutdown different, as long as the Shut_wr/shut_ The fin packet is sent by the RDWR mode call. 6.so_linger and Close, when the So_linger option is on but the timeout value is 0 o'clock, call close to send the RST directly (this avoids entering the time_wait state, but destroys the way the TCP protocol works), So_ Linger has no effect on shutdown. There is no direct relationship between the RST on the 7.TCP connection and the subsequent possible time_wait state, the active fin outsourcing will inevitably enter the TIME_WAIT state unless the fin is sent directly to end the connection with the RST.

Shutdown/close of TCP on Linux

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.