2

When send on an asynchronous socket returns EAGAIN, does that mean : that the current call has just been successfully queued or that nothing was done because the system is still processing a previous send ?

Thank you in advance.

2 Answers 2

6

From man 2 send:

The socket is marked nonblocking and the requested operation would block. POSIX.1-2001 allows either error to be returned for this case, and does not require this constants [EAGAIN EWOULDBLOCK] to have the same value, so a portable application should check for both possibilities.

So, I think EAGAIN means: be careful, the message did not fit into send buffer, this call would be blocked in normal (blocking) mode. Use select(2) to determine whether you can send more data.

P.S. Actually, looks like the call failed and nothing was done.

Sign up to request clarification or add additional context in comments.

Comments

2

Nothing was done.

If something is done, the return value tells you how many characters were sent. As you get the return value -1 and errno=EAGAIN, nothing was sent.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.