Moxa ioPAC 8500-9-M12-C-T [54/66] Mx_ras_connect

Moxa ioPAC 8020-9-M12-C-T [54/66] Mx_ras_connect
Developer's Guide for Moxa RTU Controllers Programmer's Guide
2-46
MX_Ras_Connect
INT32 MX_Ras_Connect(UINT8 *serverName, UINT32 heartBeatS, UINT8 *ipAddress, UINT16
port, UINT32 timeoutMs, UINT32 *sHandle);
This function establishes a TCP connection to the Active OPC (RAS) server and retrieves the connection handle
from the parameter sHandle. The handle is used by RAS API functions.
Input Parameters
serverName
A C string with NULL terminated. Active OPC Server combines this string and the MAC address as
a primary key to identify the TCP connection. Connections with the same primary key are
classified as the same device by the Active OPC Server. The maximum length is 256 bytes,
including one NULL-terminated byte.
hearBeatS
Heart-beat interval in seconds (0: disable heartbeat)
ipAddress
Active OPC Server IP address
port
Active OPC server listened port (9900 is recommended)
timeoutMs
Timeout interval in milliseconds
Output Parameters
sHandle
The returned TCP connection handle.
Return Value
RAS_ERR_OK: If this code is returned, sHandle should be released by MX_Ras_Close().
RAS_ERR_LIB_INIT
RAS_ERR_PARAM
RAS_ERR_CREATE_THREAD
RAS_ERR_SOCKET
RAS_ERR_TIMEOUT
RAS_ERR_CONNECT
RAS_ERR_NO_MEMORY
RAS_ERR_NO_QUEUE
MX_Ras_Disconnect
INT32 MX_Ras_Disconnect(UINT32 sHandle);
This function closes the connection and clears all registered tags. Use MX_Ras_Reconnect instead to reconnect
to the Active OPC Server and keep all registered tags.
Input Parameters
sHandle
The opened connection handle.
Output Parameters
None
Return Value
RAS_ERR_OK
RAS_ERR_LIB_INIT
RAS_ERR_PARAM

Содержание

Скачать