diff --git a/pymodbus/client/tcp.py b/pymodbus/client/tcp.py index a99700734..5b9478d59 100644 --- a/pymodbus/client/tcp.py +++ b/pymodbus/client/tcp.py @@ -47,6 +47,8 @@ def __init__( asyncio.Protocol.__init__(self) if "CommType" not in kwargs: kwargs["CommType"] = CommType.TCP + if source_address: + kwargs["source_address"] = source_address ModbusBaseClient.__init__( self, framer=framer, diff --git a/pymodbus/transport/transport.py b/pymodbus/transport/transport.py index 34eaa4796..170964e6c 100644 --- a/pymodbus/transport/transport.py +++ b/pymodbus/transport/transport.py @@ -37,7 +37,7 @@ class CommParams: timeout_connect: float = None host: str = "127.0.0.1" port: int = 0 - source_address: tuple[str, int] = ("127.0.0.1", 0) + source_address: tuple[str, int] = ("0.0.0.0", 0) handle_local_echo: bool = False # tls