Why is there no flag like MSG_WAITALL for send?

女生的网名这么多〃 提交于 2020-01-14 18:48:09

问题


The flag MSG_WAITALL can be used for recv, which requests recv to block until the full request is satisfied. That means recv will not return until as much data as requested (specified by the argument len) has been received, unless an error occurs or the connection has been closed.

Why doesn't such a flag apply to send too? I think it would be very useful for sending (send doesn't return until ALL the bytes the caller wants to send has been handed to TCP send buffer)


回答1:


It would be redundant. You can always put the socket into blocking mode, if it isn't already, in which case send() blocks until all the data has been transferred.



来源:https://stackoverflow.com/questions/44240934/why-is-there-no-flag-like-msg-waitall-for-send

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!