diff --git a/pymodbus/client/base.py b/pymodbus/client/base.py index dbf0976e15..fccf7ca346 100644 --- a/pymodbus/client/base.py +++ b/pymodbus/client/base.py @@ -85,7 +85,7 @@ def __init__( # pylint: disable=too-many-arguments setup_params = CommParams( comm_type=kwargs.get("CommType"), comm_name="comm", - source_address=kwargs.get("source_address", ("localhost", 0)), + source_address=kwargs.get("source_address", ("127.0.0.1", 0)), reconnect_delay=reconnect_delay, reconnect_delay_max=reconnect_delay_max, timeout_connect=timeout, diff --git a/pymodbus/transport/transport.py b/pymodbus/transport/transport.py index 50cfc076b9..7762b77add 100644 --- a/pymodbus/transport/transport.py +++ b/pymodbus/transport/transport.py @@ -35,9 +35,9 @@ class CommParams: reconnect_delay: float = None reconnect_delay_max: float = None timeout_connect: float = None - host: str = "localhost" + host: str = "127.0.0.1" port: int = 0 - source_address: tuple[str, int] = ("localhost", 0) + source_address: tuple[str, int] = ("127.0.0.1", 0) # tls sslctx: ssl.SSLContext = None @@ -93,7 +93,7 @@ class ModbusProtocol(asyncio.BaseProtocol): Host/Port/SourceAddress explanation: - SourceAddress: - - server: (host, port) to listen on (default is ("localhost", 502/802)) + - server: (host, port) to listen on (default is ("127.0.0.1", 502/802)) - server serial: (host, _) to open/connect and listen on - client: (Bind local part to interface (default is local interface) - client serial: (host, _) to open/connect and listen on