Back to Adaptive Vision Library website

You are here: Start » Function Reference » Modbus TCP » ModbusTCP_Connect

ModbusTCP_Connect


Connects as a client to a remote Modbus server socket.

Syntax

void avl::ModbusTCP_Connect
(
	TcpIpConnectState& ioState,
	const atl::String& inHost,
	int inPort,
	const atl::Optional<int>& inTimeout,
	const atl::Optional<int>& inKeepAliveTime,
	atl::Conditional<avl::SocketId>& outSocket
)

Parameters

Name Type Range Default Description
ioState TcpIpConnectState& Object used to maintain state of the function.
inHost const String& \"localhost\" The hostname or IP address to connect to.
inPort int 7 - 65535 502 Modbus port of host to connect to. 502 is the default one.
inTimeout const Optional<int>& 500 - NIL Timeout in milliseconds, block if not specified.
inKeepAliveTime const Optional<int>& 2000 - NIL When specified activates Tcp/Ip keep alive on new socket with given idle time.
outSocket Conditional<SocketId>& Connected socket ID.

Description

For more details please check help of TcpIp_Connect filter. The filters works in the same way.

Multithreaded environment

This function is not guaranteed to be thread-safe. When used in multithreaded environment, it has to be manually synchronized.

See Also