WSGetDomainNameList (C Function)

char ** WSGetDomainNameList(WSENV env, unsigned long *s)

returns a list of ASCII strings containing the domain names available on the machine and the length of the list in s.

Details

  • WSGetDomainNameList() loads the DNS domain names for each active network interface available on the machine.
  • WSGetDomainNameList() allocates memory to store the domain names that must be released. To release the memory allocated by WSGetDomainNameList(), call WSReleaseDomainNameList() on the list returned by WSGetDomainNameList().
  • WSGetDomainNameList() returns NULL on failure.
  • WSGetDomainNameList() is declared in the WSTP header file wstp.h.

Examples

Basic Examples  (1)

#include "wstp.h"

/* A function that reads the domain names available on a machine */

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

    theList = WSGetDomainNameList(env, &length);

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

        WSReleaseDomainNameList(env, theList, length);
    }
}