First of all, I set the socket to asynchronous, and then when I use write to send data, the way is to loop a large amount of data, because it is asynchronous, Write\send will send the data submitted to the send buffer is immediately returned, do not need to confirm the data received. In this case, it is quite possible that the send buffer is filled up, causing the write\send to no longer commit the data to be sent to the buffer. So there is the resource temporarily unavailable error, Eagain meaning is also obvious, is to you try again.
literally, it's 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, if you do a sequential read operation and no data is 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 processing Eagain error when the Linux non-blocking socket receive data often appear 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.
Ireadsizeonce=read (iopencom,rxbuf+ireadsize,1024x768); if (ireadsizeonce! = ZERO) { if (ireadsizeonce! = Eagain ) {continue; } Else { //stccomapilog.logerror ("Read serial operation Error"); return (Fun_error); } }