How do I implement epoll timeout?

Keep a list of the sockets sorted by the time remaining until they time out (if the timeout period is the same for all sockets, then this is equivalent to sorting them by the time of the last recieved message). Each time you call epoll_wait() select the socket with the shortest remaining time until it times out (which will be at the front of your list). Use that time as the timeout in epoll_wait() .

You can create a recurring timerfd and add it to your epoll set. It will wake you up however often you like, at which point you can check all your client connections and drop the ones you think are stale.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions