簡體   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