What is a socket timeout ~

Source: Internet
Author: User
For a socket read-write (read/write) operation is blocked by default, if the current socket is not read/write, then this operation will continue to block, which is called the socket timeout;
This is unacceptable for a server that needs high performance. Therefore, the time-out value can be specified during read and write operations, so that the read and write operations are not blocked.
There are three ways to set timeouts on I/O operations that involve sockets:
1: Call alarm, which generates a SIGALRM signal when the specified timeout expires. This approach involves signal processing, and signal processing differs in different implementations, and may interfere with existing alarm calls in the process.
2: Block wait I/O in select (select has a built-in time limit), instead of blocking directly on the read or write call. (The linux2.6 kernel can also use Epoll's epoll_wait)
3: Use newer So_rcvtimeo and So_sndtimeo socket options. The problem with this approach is that not all implementations support these two socket options.

What is a socket timeout ~

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.