简体   繁体   English

epoll_wait()是否报告所有关闭套接字事件?

[英]does epoll_wait() report all close socket events?

or do I need to watch too for the return values of read() or write() to know when to close a socket 还是我也需要注意read()或write()的返回值才能知道何时关闭套接字
or it depends on some flags? 还是取决于某些标志?
this question is for epoll in edge triggered mode 这个问题是针对边缘触发模式下的epoll

epoll_wait() will not report a close(soc) if it is called on your process. 如果在您的进程中调用了epoll_wait(),则不会报告close(soc)。 It will instead silently remove the socket from the epoll set. 相反,它将以静默方式从epoll集中移除套接字。

I would monitor for EPOLLHUP, EPOLLRDHUP and EPOLLIN to detect closure. 我将监视EPOLLHUP,EPOLLRDHUP和EPOLLIN以检测关闭。 Regardless, if there is a remote closure, you should get an event though, either EPOLLIN, EPOLLHUP or EPOLLERR. 无论如何,如果存在远程关闭,您都应该获得一个事件,无论是EPOLLIN,EPOLLHUP还是EPOLLERR。

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

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