Here is my server
\"\"\"Server using epoll method\"\"\"
import os
import select
import socket
import time
from oodict import OODict
addr = (\
If the socket is still open but no read/write available epoll.poll will timeout.
If data if available from the peer, you get an EPOLLIN and data will be available.
If the socket is closed by the peer, you will get an EPOLLIN but when you read it it will return "".
you could then close the socket by shutting it down and picking up the resulting EPOLLHUP event to clean up your internal structures.
or perform cleanup and unregister the epoll.
elif event & select.EPOLLIN:
data = cs[fileno].recv(4)
if not data:
epoll.modify(fileno, 0)
cs[fileno].shutdown(socket.SHUT_RDWR)