套接字:非阻塞关机(SHUT_WR)? [英] Sockets: Non-blocking shutdown(SHUT_WR)?

查看:58
本文介绍了套接字:非阻塞关机(SHUT_WR)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法异步关闭套接字(SHUT_WR)?

Is there a way to do shutdown(SHUT_WR) on socket asynchronously?

即启动操作,然后使用 poll 等待操作完成?

I.e. start the operation, then wait for its completion using poll?

推荐答案

无论如何它都是异步的.它只是在套接字发送缓冲区的当前内容后面排队一个 FIN,如果有的话,这实际上只是在某处设置了一点.没有用于完成任何发送的 poll() 操作,更不用说这个了.

It's asynchronous anyway. It just queues a FIN behind the current contents of the socket send buffer, if any, which really just amounts to setting a bit somewhere. There's no poll() operation for completion of any send, let alone this one.

这篇关于套接字:非阻塞关机(SHUT_WR)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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