Eagain, Ewouldblock, eintr with non-blocking long connections ewouldblock for non-blocking mode, no need to reread or write eintr means the operation was interrupted to wake up, You need to reread the / Writing in Linux environments often encounters many errors (setting errno), where Eagain is one of the more common errors (for example, in non-blocking operations). Literally, it is a hint to try again. This error often occurs when the application is doing some non-blocking (non -blocking) operations (for files or sockets). For example, open the file with the O_nonblock flag/socket/fifo, if you do a sequential read operation without data readable. At this point the program does not block up and waits for the data to be ready to return, and the Read function returns an error eagain, prompting your application to now have no data to read please try again later. For example, when a system call (such as fork) fails because there is not enough resources (such as virtual memory), the return eagain prompts it to be called again (perhaps next time it succeeds). Linux - non-blocking socket programming handles Eagain errors often occur during Linux non-blocking socket receive data resource temporarily Unavailable,errno code for one (Eagain), what does this mean? This indicates that you have a blocking operation in non-blocking mode, which returns the error if the operation is not completed, which does not break the synchronization of the socket, regardless of the next loop and then recv. For non-blocking sockets, Eagain is not an error. On VxWorks and Windows, Eagain is named Ewouldblock. Additionally, if EINTR is present as errno 4, the error description interrupted system call, the operation should also continue. Finally, if the return value of recv is 0, it indicates that the connection has been disconnected and our receive operation should end.
Reprinted from: http://blog.chinaunix.net/uid-23849526-id-120552.html
Eagain, Ewouldblock, eintr and non-blocking long connections