什么会导致 sock send() 命令出现“资源暂时不可用" [英] What can cause a “Resource temporarily unavailable” on sock send() command

查看:31
本文介绍了什么会导致 sock send() 命令出现“资源暂时不可用"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么会导致套接字 send() 命令上的 Resource 暂时不可用 错误?套接字设置为AF_UNIX, SOCK_STREAM.它大部分时间都有效,但偶尔会出现此错误.套接字的接收端似乎工作正常.

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!

推荐答案

"Resource暂时不可用"EAGAIN对应的错误信息,表示操作将已阻塞但请求了非阻塞操作.对于 send(),这可能是由于:

"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:

  • 使用 fcntl() 显式地将文件描述符标记为非阻塞;或
  • MSG_DONTWAIT 标志传递给send();或
  • 使用 SO_SNDTIMEO 套接字选项设置发送超时.
  • 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.

这篇关于什么会导致 sock send() 命令出现“资源暂时不可用"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆