A closed socket is no exception (error). What will happen since the socket will be on the read list (lin), and when you read it, you will get 0 bytes. This means that the other end has closed the nest.
Update
In normal practice, you will never see anything in the exception list and you can safely ignore it. This is for rarely used things like out-of-band (OOB), etc.
Answer the question about updates :
Reliably and quickly detecting that the other end of the socket is gone can be difficult. If it is important that this is reliable, always and on time, you should use a higher level mechanism such as keepalive / heartbeat.
If the client performs a clean shutdown of the socket, you should see the socket in the read list. Reading from the socket will return 0 bytes, indicating that the socket is closed (EOF).
source share