diff --git a/pymodbus/client/sync.py b/pymodbus/client/sync.py index 571ba0f4f..cde8a0bf1 100644 --- a/pymodbus/client/sync.py +++ b/pymodbus/client/sync.py @@ -290,7 +290,11 @@ def _recv(self, size): time_ = time.time() end = time_ + timeout while recv_size > 0: - ready = select.select([self.socket], [], [], end - time_) + try: + ready = select.select([self.socket], [], [], end - time_) + except ValueError: + return self._handle_abrupt_socket_close( + size, data, time.time() - time_) if ready[0]: recv_data = self.socket.recv(recv_size) if recv_data == b'':