I have developed a simple server that uses epoll_wait with TCP
sockets. The server program listens to incoming connections on
listening socket and on acceptiong incoming connections adds them to
the pollset to be waited upon by epoll_wait.
I would like to know how can I produce a condition by which the event
EPOLLHUP is generated and returned by epoll_wait for a socket fd ?
Pls guide.
my guess would be that EPOLLHUP is the "epoll" version of POLLHUP...
for TCP socket, this means that the socket is half-closed as result of
a shutdown().
HTH,
Loïc
--
My Blog: http://www.domaigne.com/blog
"One of the main causes of the fall of the Roman Empire was that–
lacking zero–they had no way to indicate successful termination of
their C programs." -- Robert Firth
Hi Loic,
I tried simulating the behaviour by writing a client program that
connects to the server and after the connection has been made, half
closes the connection with shutdown(SHUT_WR).
The server still receives the EPOLLIN event, no EPOLLHUP event is
received.
Kindly help
From the experiments I made (using poll, not epoll), I found out that
you get a POLLHUP only after receiving a RST segment. This means that
the client has closed the socket (e.g. due to a crash), and the server
has performed one write on the closed socket.
HTH,
Loïc.
--
My Blog: http://www.domaigne.com/blog
"The first 90% of the code accounts for the first 90% of the
development time. The remaining 10% of the code accounts for the other
90% of the development time." -- Tom Cargill