add timeout msg to client

This commit is contained in:
Bastian Schroll 2018-01-12 09:02:07 +01:00
parent e1bbff7a93
commit d08e11e17e

View file

@ -97,6 +97,8 @@ class TCPClient:
received = str(self._sock.recv(1024), "utf-8")
logging.debug("received: " + received)
return received
except socket.timeout:
logging.warning("cannot receive - timeout after %s sec", self._timeout)
except AttributeError:
logging.error("cannot receive - no connection established")
return False