does epoll_wait() report all close socket events?

342 Views Asked by At

or do I need to watch too for the return values of read() or write() to know when to close a socket
or it depends on some flags?
this question is for epoll in edge triggered mode

1

There are 1 best solutions below

0
Peter On

epoll_wait() will not report a close(soc) if it is called on your process. It will instead silently remove the socket from the epoll set.

I would monitor for EPOLLHUP, EPOLLRDHUP and EPOLLIN to detect closure. Regardless, if there is a remote closure, you should get an event though, either EPOLLIN, EPOLLHUP or EPOLLERR.