Program exit problems caused by Linux network programming-sigpipe signals

Source: Internet
Author: User

When the client close closes the connection, if the server side then sends the data, according to the TCP protocol, the server side receives the RST response, when the server side sends the data to the client again, the system sends a SIGPIPE signal to the server process. Tell the server process that the peer connection is closed and no more data is being written. However, according to the default rules of the signal, the default processing action of the SIGPIPE signal is terminate (terminating), so the server process ends. This causes the server to shut down due to client side shutdown.

In commercial development, this situation cannot be allowed. The way to avoid this is to ignore the sigpipe signal by adding the phrase "signal (sigpipe,sig_ign)" to the code.

Program exit problems caused by Linux network programming-sigpipe signals

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.