I am working on a network programming using epoll. I was wondering the best way to detect user disconnection. Right now, I am using select with timeout to see if there is a signal in the receive buffer and there is no signal for a certain amount of time then it closes the socket connection.
I think there might be something else more suitable for epoll instead of using select.
Thanks in advance..
No, there is not. If you need to discover an inactive or dead client, you have to do it yourself.
(e.g. send them some form of heartbeat messages and see if they respond/error within a timeout, or do as you’re already doing and time them out after a perioid of inactivity.)