繁体   English   中英

Linux 上的异​​步套接字发送

[英]Asynchronous socket send on Linux

当异步套接字上的发送返回 EAGAIN 时,这是否意味着:当前调用刚刚成功排队,或者由于系统仍在处理先前的发送而什么也没做?

先感谢您。

man 2 send

套接字被标记为非阻塞,请求的操作将阻塞。 POSIX.1-2001 允许在这种情况下返回任一错误,并且不要求此常量 [EAGAIN EWOULDBLOCK] 具有相同的值,因此可移植应用程序应检查这两种可能性。

所以,我认为EAGAIN意思是: be careful, the message did not fit into send buffer, this call would be blocked in normal (blocking) mode. Use select(2) to determine whether you can send more data. be careful, the message did not fit into send buffer, this call would be blocked in normal (blocking) mode. Use select(2) to determine whether you can send more data.

PS 实际上,看起来呼叫失败并且什么也没做。

什么也没做。

如果完成了某些操作,返回值会告诉您发送了多少个字符。 当您获得返回值 -1 和 errno=EAGAIN 时,没有发送任何内容。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM