In Linux, development 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/socket/fifo with the O_nonblock flag, and if you do a continuous read operation without data readability, the program will not block up and wait for the data to be ready to return, and the Read function will return an error Eagain Tip Your app now has 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 processing Eagain error
What does it mean when a non-blocking socket on Linux receives data that often appears resource temporarily Unavailable,errno code (eagain)?
This indicates that you have a blocking operation in non-blocking mode, and return this error if the operation is not completed, which will not break the socket synchronization, do not control it, and the next loop will be recv. For non-blocking sockets, Eagain is not an error. On VxWorks and Windows, Eagain is named Ewouldblock.
In addition, if EINTR is present, errno is 4, error description interrupted system call, the operation should continue.
Finally, if the return value of recv is 0, it indicates that the connection has been broken and our receive operation should end.
Ireadsizeonce=read (iopencom,rxbuf+ireadsize,1024x768); if (ireadsizeonce! = ZERO) {if (ireadsizeonce! = Eagain ) {continue; } Else { //stccomapilog.logerror ("Read serial operation Error"); return (Fun_error);} }