ModbusTCP_Connect
Connects as a client to a remote Modbus server socket.
Syntax
C++
Python
def ModbusTCP_Connect( state: TcpIpConnectState, inHost: str, inPort: int, /, *, inTimeout: int | None = None, inKeepAliveTime: int | None = None ) -> outSocket: int | None
Parameters
| Name | Type | Range | Default | Description | |
|---|---|---|---|---|---|
![]() |
ioState | TcpIpConnectState | |||
![]() |
inHost | str | The hostname or IP address to connect to. | ||
![]() |
inPort | int | 7 - 65535 | Modbus port of host to connect to. 502 is the default one. | |
![]() |
inTimeout | int | None | 500 - ![]() |
None | Timeout in milliseconds, block if not specified. |
![]() |
inKeepAliveTime | int | None | 2000 - ![]() |
None | When specified activates Tcp/Ip keep alive on new socket with given idle time. |
![]() |
outSocket | int | None | Connected socket ID. |




