Skip to content

Commit

Permalink
Catch socket going away. (#722)
Browse files Browse the repository at this point in the history
  • Loading branch information
janiversen authored Mar 27, 2022
1 parent d53edcc commit 93fc0fb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pymodbus/client/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'':
Expand Down

0 comments on commit 93fc0fb

Please sign in to comment.