8

Why am I getting the EPOLLHUP event on a brand new socket

view full story
linux-howto

http://stackoverflow.com – I have some code that when run on a virtual machine is misbehaving for some reason. The order of initialization is: s_listen = socket(...) bind(s_listen, ...) epoll_ctl(epfd, EPOLL_CTL_ADD, s_listen, ...) listen(s_listen, SOMAXCONN) There is an event loop/thread running and processing events on the epoll file descriptor before bind is even called. That event loop gets an EPOLLHUP before the call to listen() on the newly created s_listen socket. So my question is, why am I getting the EPOLLHUP event on a brand new socket? The error goes away when I put the epoll_ctl after call to listen (HowTos)