Solution
LabVIEW
- Use the String to IP function from the TCP palette.
- To obtain all IP addresses of the computer, right-click the String to IP function and select Multiple Outputs.
- Using the String to IP functions, DHCP IPs assigned to Target can be obtained.
LabWindows™/CVI
- Call the GetTCPHostAddr function.
- To obtain all IP addresses of the computer, call GetALLTCPHstAddresses.
The following example shows how to implement this in LabWindpws™/CVI. This is accomplished by passing an address of a pointer to pointer to a char variable. The library allocates an array of strings which must be freed using the TCPFreeMemory function.
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);