What can cause a “Resource temporarily unavailable” on sock send() command

giroy picture giroy · Jan 17, 2013 · Viewed 169.6k times · Source

What can cause a Resource temporarily unavailable error on a socket send() command? The socket is setup as AF_UNIX, SOCK_STREAM. It works most of the time, but occasionally gets this error. The receiving end of the socket appears to be working properly.

I know this isn't very detailed, but I'm just looking for general ideas. Thanks!

Answer

caf picture caf · Jan 17, 2013

"Resource temporarily unavailable" is the error message corresponding to EAGAIN, which means that the operation would have blocked but nonblocking operation was requested. For send(), that could be due to any of:

  • explicitly marking the file descriptor as nonblocking with fcntl(); or
  • passing the MSG_DONTWAIT flag to send(); or
  • setting a send timeout with the SO_SNDTIMEO socket option.