socket.shutdown raises an exception on Windows when the socket has already been disconnected.