LabWindows/CVI

Content Type
Programming Language
Current manual

GetAllTCPHostAddresses

GetAllTCPHostAddresses

int GetAllTCPHostAddresses (char ***addresses, int *numberOfAddresses);

Purpose

Obtains all the network interface IP addresses of the computer on which your program is currently running.

Parameters

Output
Name Type Description
addresses char ** Pass the address of a pointer to pointer to char variable. The library allocates an array of strings representing the network interface addresses and returns them in this output parameter. When no longer needed, you must free all the address strings and the address array using the TCPFreeMemory function, as follows:

Example Code

char ** addresses = NULL;
int numAddresses;
int index;

GetAllTCPHostAddresses (&addresses, &numAddresses);

/* Use the address strings... */

for (index = 0; index < numAddresses; index++)

{

/* Free address string */
TCPFreeMemory (addresses[index]);

}

/* Free addresses array */
TCPFreeMemory (addresses);

numberOfAddresses int Number of address strings returned in the addresses parameter.

Return Value

Name Type Description
status int 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 Support Library error codes. To obtain the correct system error message, you must call GetTCPSystemErrorString immediately after calling the TCP Support Library function that failed.

For RegisterTCPServer and RegisterTCPServerEx, the return value is the port number assigned by the system if you passed zero for the port and the function was successful.

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.

Additional Information

Library: TCP Support Library

Include file: tcpsupp.h

LabWindows/CVI compatibility: LabWindows/CVI 7.1 and later

Was this information helpful?