def _send(self, request): """Send request to the slave""" retval = call_hooks("modbus_tcp.TcpMaster.before_send", (self, request)) if retval is not None: request = retval try: flush_socket(self._sock, 3) except Exception as msg: #if we can't flush the socket successfully: a disconnection may happened #try to reconnect LOGGER.error('Error while flushing the socket: {0}'.format(msg)) self._do_open() self._sock.send(request)
def _send(self, request): """Send request to the slave""" retval = call_hooks("modbus_tcp.TcpMaster.before_send", (self, request)) if retval is not None: request = retval try: flush_socket(self._sock, 3) except Exception as msg: #if we can't flush the socket successfully: a disconnection may happened #try to reconnect LOGGER.error('Error while flushing the socket: {0}'.format(msg)) self._do_open() self._sock.send(request)