When the send function of the socket is executed, the eagain error is returned.

Source: Internet
Author: User

When the send function of socket is executed, the eagain error is returned.]

Abstract:

When the customer sends large data packets through the send function provided by socket, an eggain error may be returned. This error is caused by sending

The size variable in the function exceeds the value of tcp_sendspace. Tcp_sendspace defines the amount of data that the application can cache in the kernel before calling send. If the o_ndelay or o_nonblock attribute is set in the socket, The eagain error is returned if the sending cache is full.

To eliminate this error, you can choose from the following three methods:
1. Increase tcp_sendspace so that it is greater than the size parameter in send
--- No-p-o tcp_sendspace = 65536

2. Before sending, set a greater value for sndbuf in the setsockopt function.

3. Replace send with write because write does not set o_ndelay or o_nonblock.

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.