diff --git a/pymodbus/transport/transport.py b/pymodbus/transport/transport.py index e643f0185..e3a4c0fb3 100644 --- a/pymodbus/transport/transport.py +++ b/pymodbus/transport/transport.py @@ -379,6 +379,9 @@ def send(self, data: bytes, addr: tuple | None = None) -> None: :param data: non-empty bytes object with data to send. :param addr: optional addr, only used for UDP server. """ + if not self.transport: + Log.error("Cancel send, because not connected!") + return Log.debug("send: {}", data, ":hex") if self.comm_params.handle_local_echo: self.sent_buffer += data