To catch a private socket event, you need to have a socket in rlist
. When the connection is closed on the other hand, select
returned and indicates that the closed connector is ready to be read (i.e., in list r
). If you execute recv
on this socket and it returns an empty list (nothing was read), this means that the connection was closed.
data = s.recv(size) if not data:
From what I saw, the exception list (the last selection option) is not widely used. The main problem is that different operating systems interpret this parameter differently. Sometimes it was even used only for cases that are not exceptions at all (OOB data).
Module documentation
socket
not specific to what this argument means, so you should generally not rely on it:
xlist: wait for the "exceptional condition" (see the manual page for what your system considers this condition)
source share