GetHostTCPSocketHandle

int GetHostTCPSocketHandle (unsigned int connectionHandle, int systemSocket);

Purpose

Obtains the system socket handle that corresponds to a TCP Support Library connection.

Parameters

Input
Name Type Description
connectionHandle unsigned integer TCP Library conversation handle that you obtain from ConnectToTCPServer or ConnectToTCPServerEx or receive in a server callback as the handle parameter of a TCP_CONNECT message.
Output
Name Type Description
systemSocket unsigned integer System socket handle for the connection that connectionHandle identifies.

Return Value

Name Type Description
status integer Return value indicating whether the function was successful. Unless otherwise stated, zero represents successful execution and a negative number represents the error code.

You can call the GetTCPSystemErrorString function to obtain a system message that describes the error. The system messages can be more descriptive than the TCP Library error codes. To obtain the correct system error message, you must call GetTCPSystemErrorString immediately after calling the TCP Library function that failed.

For functions that read or write data (ClientTCPRead, ClientTCPWrite, ServerTCPRead, ServerTCPWrite), if the function was successful, the return value is the number of bytes transferred.

You can have a maximum of 255 concurrent conversations and up to 1,024 connections. If you exceed this limit, -kTCP_TooManyConnections will be returned. You may not be able to open the maximum number of connections allowed by LabWindows/CVI because of limitations imposed by the operating system.