Also catch SocketExceptions.