getpeername() raised ENOTCONN when a connect failed or the peer
closed the socket, crashing the event loop thread. Identify sockets
via the selector key's data (set at register time) instead, and
catch OSError on recv/send to cleanly close and unregister a dead
socket rather than crashing.
Also fix select(timeout=100) which waited 100 seconds instead of
100ms, causing stop() to hang after a dead socket was unregistered.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>