epollet

Epoll in EPOLLET mode returning 2 EPOLLIN before reading from the socket

The epoll manpage says that a fd registered with EPOLLET(edge triggered) shouldn't notify twice EPOLLIN if no read has been done. So after an EPOLLIN you need to empty the buffer before epoll_wait being able to return a new EPOLLIN on new data. However I'm experiencing problems with this approach as I'm seeing duplicated EPOLLIN event...

why the EPOLLOUT is always triggered even when it is in EdgeTriggered mode ?

after reading the epoll man, i thought the EPOLLOUT will only be triggered when the fd comes writeable from unwriteable. but i tried on stdout and it's always triggered EPOLLOUT and i didn't write anything into stdout. why is that ? thanks ...

nonblocking socket recv problem while using it with epoll

hi there. i've got a problem: sometimes (not regularly) recv returns -1 and errno == EAGAIN while using epoll in edge-triggered mode. piece of code: server_sock = startup(&port); if ( (epollfd = epoll_create(4096)) < 0) { perror("epoll_create error"); exit(EXIT_FAILURE); } ev.events = EPOLLIN | EPOLLET; ev.data.fd = server_soc...

How to read multiple file descriptors using epoll_select with EPOLLET?

man epoll: The suggested way to use epoll as an edge-triggered (EPOLLET) interface is as follows: i with nonblocking file descriptors; and ii by waiting for an event only after read(2) or write(2) return EAGAIN. Imagine we have two fds: the first is passive, data available only sometimes, the second is active, data only som...