gethostent() and getnetent()

Darren Reed avalon at coombs.anu.edu.au
Tue Jun 18 13:58:43 AEST 1991


When using the gethostent() function call and its related calls,
it doesnt seem to return any aliases in haliases even though,
according to nslookup the hostname in question has an alias.
the code follows :

		a = inet_addr(s);
		host = gethostbyaddr(&a, sizeof(a), AF_INET);

Am i doing something wrong here ?

I have also tried to use getnetbyaddr() in much the same manner as the
above call to gethostbyaddr(), but getnetbyaddr() or getnetbyname()
only ever seem to return a NULL pointer.
ie:
		a = inet_network(s);
		net = getnetbyaddr(&a, sizeof(a), AF_INET);

will return net as a NULL pointer.

thanks,
-avalon



More information about the Comp.unix.programmer mailing list