user800799
user800799

Reputation: 3013

How do I handle client disconnect (epoll)

I am working on a network programming using epoll. I was wondering how I can handle client disconnect. I read api document and epoll_wait had a argument for timeout. However, I was confused if the time out for the epoll_wait function or for the client that are being connected.

Thanks in advance..

Upvotes: 1

Views: 1175

Answers (1)

Nithesh
Nithesh

Reputation: 72

timeout specified is for epoll_wait. To handle client disconnect, Handle EPOLLHUP raised by epoll and also check if the recv function on socket returns zero that means socket is disconnected.

Upvotes: 1

Related Questions