c++ - Linux 上的异​​步套接字发送

标签 c++ linux sockets asynchronous send

当在异步套接字上发送时返回 EAGAIN,这是否意味着: 当前调用刚刚成功排队,或者由于系统仍在处理之前的发送而未执行任何操作?

提前谢谢你。

最佳答案

来自 man 2 send:

The socket is marked nonblocking and the requested operation would block. POSIX.1-2001 allows either error to be returned for this case, and does not require this constants [EAGAIN EWOULDBLOCK] to have the same value, so a portable application should check for both possibilities.

所以,我认为 EAGAIN 的意思是:小心,消息不适合发送缓冲区,此调用将在正常(阻塞)模式下被阻塞。使用select(2)判断是否可以发送更多数据。

附言实际上,看起来调用失败了,什么也没做。

关于c++ - Linux 上的异​​步套接字发送,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5633226/

相关文章:

C++ 随机数逻辑运算符奇怪的结果

C++将文本写入文件,如何多行

c++ - RTF文本是否为空

c++ - 创建在 "all"Linux 发行版上运行的二进制文件

python - 如何在Python中的一个客户端上创建多服务器套接字?

javascript - Web Worker 中的 Chrome 套接字?

c++ - MFC 强制 CMultiDocTemplate 中的 CFormView 始终位于顶部

linux - 如何根据用户输入更新 case 语句中的变量

linux - 用于格式化管道输出的 bash 脚本

sql-server - Windows 2003 中 JDBC 连接可用的套接字数