Moxa ioPAC 8500-2-M12-C-T [45/66] Modbus tcp master

Moxa ioPAC 8020-5-M12-C-T [45/66] Modbus tcp master
Developer's Guide for Moxa RTU Controllers Programmer's Guide
2-37
Modbus/TCP Master
MX_Modbus_Tcp_Master_Open
INT32 MX_Modbus_Tcp_Master_Open(UINT8 ipAddress[], UINT16 tcpPort, UINT32 cTimeoutMs,
UINT32 *sHandle);
This function establishes a TCP connection to the target IP address. If the returned code is MODBUS_ERR_OK,
the connection handle sHandle should be closed by the function MX_Modbus_Tcp_Master_Close.
Input Parameters
ipAddress
The IP address of the Modbus slave
tcpPort
The TCP listened port of the Modbus master
cTimeoutMs
Modbus address
Output Parameters
sHandle
Returned connection handle.
Return Value
MODBUS_ERR_OK
MODBUS_ERR_LIB_INIT
MODBUS_ERR_PARAM
MODBUS_ERR_SOCKET: Socket error
MODBUS_ERR_TIMEOUT: Connect timeout
MODBUS_ERR_CONNECT: Connect to target error
MODBUS_ERR_HANDLE: No more handles
MX_Modbus_Tcp_Master_Close
INT32 MX_Modbus_Tcp_Master_Close(UINT32 sHandle);
This function closes the TCP connection established by MX_Modbus_Tcp_Master_Open.
Input Parameters
sHandle
TCP connection handle
Output Parameters
None
Return Value
MODBUS_ERR_OK
MODBUS_ERR_LIB_INIT
MODBUS_ERR_PARAM
MODBUS_ERR_NOT_OPENED

Содержание

Скачать