OpenersNotesSection(Spacer1)Details

WSGetNetworkAddressList() loads the IP numbers for each active network interface on the machine.

WSGetNetworkAddressList() loads both IPv4 and IPv6 numbers.

WSGetNetworkAddressList() allocates memory to store the addresses that must be released. To release the memory allocated by WSGetNetworkAddressList(), call (NonWLLink[WSReleaseNetworkAddressList(), paclet:ref/c/WSReleaseNetworkAddressList]) on the list returned by WSGetNetworkAddressList().

WSGetNetworkAddressList() returns NULL on failure.

WSGetNetworkAddressList() is declared in the WSTP header file (RefLink[wstp.h, paclet:ref/file/wstp.h]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

#include "wstp.h"

/* A function that reads the IP addresses available on a machine */

void f(WSENV env)
{
	char **theList = NULL;
	char *tmp;
	unsigned long length;

	theList = WSGetNetworkAddressList(env, &length);

	if(length > 0 && theList != (char **)0)
	{
		while((tmp = *theList++) != (char *)0)
		{
			/* ... */
		}

		WSReleaseNetworkAddressList(env, theList, length);
	}
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[WSReleaseNetworkAddressList(), paclet:ref/c/WSReleaseNetworkAddressList])  ▪  (NonWLLink[WSReleaseDomainNameList(), paclet:ref/c/WSReleaseDomainNameList])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[WSTP C API Developer Guide (Mac OS X), paclet:tutorial/WSTPDeveloperGuide-MacintoshOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Unix and Linux), paclet:tutorial/WSTPDeveloperGuide-UnixOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Windows), paclet:tutorial/WSTPDeveloperGuide-WindowsOverview])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Alphabetical Listing of WSTP C Functions, paclet:guide/AlphabeticalListingOfWSTPCFunctions])}, {▪(RefLinkPlain[WSTP Connection Management, paclet:guide/WSTPConnectionManagement])}})}})