Handle SocketException on client side