I have a fd:
socket(AF_INET6, SOCK_STREAM, ...)
bind(fd, ...)
listen(fd, ...)
And I have a epoll
instance. I need to know, what events should I subscribe to via epoll_ctl
? I need Edge Triggered mode.
I have those flags atm: EPOLLET | EPOLLIN
EPOLLET | EPOLLIN
Should I subscribe to EPOLLRDHUP
, EPOLLOUT
, EPOLLPRI
?
Should I handle EPOLLHUP
, EPOLLERR
? Why they can occur?
You ask specifically about the passive socket used to accept incoming connection requests. The example in man epoll doesn't subscribe to EPOLLRDHUP
, EPOLLOUT
, EPOLLPRI
for the listening socket, and understandably so:
EPOLLOUT
means: Writing now will not block. - There is no writing on the passive socket. EPOLLRDHUP
applies to connections. There isn't a connection on the passive socket. EPOLLPRI
means: There is urgent data to read . There's no urgent data on a passive socket. Also the example doesn't handle EPOLLHUP
, EPOLLERR
for the listening socket. That's at least understandable for EPOLLHUP
, since that applies to output only . I know of no case where EPOLLERR
would be returned for the passive socket.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.