char ** WSGetNetworkAddressList(WSENV e, unsigned long *n)

returns a list of ASCII strings containing the IP addresses of all the configured network interfaces on a machine and the length of list in n.


  • 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 WSReleaseNetworkAddressList() on the list returned by WSGetNetworkAddressList().
  • WSGetNetworkAddressList() returns NULL on failure.
  • WSGetNetworkAddressList() is declared in the WSTP header file wstp.h.


Basic Examples  (1)

#include "wstp.h"

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

void f(WSENV e)
    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);

See Also

WSReleaseNetworkAddressList()  WSReleaseDomainNameList()