Skip to content

Commit

Permalink
pass source_address in tcp client. (#1700)
Browse files Browse the repository at this point in the history
  • Loading branch information
janiversen authored Jul 25, 2023
1 parent c43119e commit 3be72db
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pymodbus/client/tcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion pymodbus/transport/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3be72db

Please sign in to comment.