Skip to content

Commit 3be72db

Browse files
authored
pass source_address in tcp client. (#1700)
1 parent c43119e commit 3be72db

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

pymodbus/client/tcp.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ def __init__(
4747
asyncio.Protocol.__init__(self)
4848
if "CommType" not in kwargs:
4949
kwargs["CommType"] = CommType.TCP
50+
if source_address:
51+
kwargs["source_address"] = source_address
5052
ModbusBaseClient.__init__(
5153
self,
5254
framer=framer,

pymodbus/transport/transport.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class CommParams:
3737
timeout_connect: float = None
3838
host: str = "127.0.0.1"
3939
port: int = 0
40-
source_address: tuple[str, int] = ("127.0.0.1", 0)
40+
source_address: tuple[str, int] = ("0.0.0.0", 0)
4141
handle_local_echo: bool = False
4242

4343
# tls

0 commit comments

Comments
 (0)