Linux-non-blocking socket programming to handle EAGAIN errors

Source: Internet
Author: User
Linux-non-blocking socket programming to handle EAGAIN errors-Linux general technology-Linux programming and kernel information, the following is a detailed description. Resource temporarily unavailable often occurs when a non-blocking socket in linux receives data. The errno code is 11 (EAGAIN). What does this mean?

This indicates that you have called the blocking operation in non-blocking mode. If the operation is not completed, this error is returned. This error will not damage the synchronization of the socket, the next cycle is followed by recv. For a non-blocking socket, EAGAIN is not an error. On VxWorks and Windows, EAGAIN is named EWOULDBLOCK.

In addition, if EINTR is returned, that is, errno is 4, and the error description is Interrupted system call, the Operation should continue.

Finally, if the returned value of recv is 0, it indicates that the connection has been disconnected and our receiving operation should also end.
Related Article

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.