check for SocketException and interrupt thread