TCP/IP Programming Manual

getipnodebyname
The getipnodebyname function gets host information based on the hostname. This function is
protocol-independent. (This function is supported for Parallel Library TCP/IP only.)
NOTE: The C synopsis is given in ANSI C format rather than the pre-ANSI C formats of the other
library routines because the only NonStop servers you can use these routines on all support ANSI
C. (ANSI C format defines the function and the arguments in the same line rather than using an
assign statement and defining the arguments underneath.)
C Synopsis
#include <netdb.h>
struct hostent *getipnodebyname (const char *name, int af,
int flags, int *error_ptr);
TAL Synopsis
?NOLIST, SOURCE SOCKDEFT
?NOLIST, SOURCE SOCKPROC
return_val := getipnodebyname(name, af, flags, error_ptr);
INT (320 return_val;
STRING .EXT name;
INT(32) af;
INT(32) flags;
INT .EXT error_ptr;
return_val
is a pointer to a structure of type hostent.
name
input value; a pointer to a node name or numeric address string, such as an IPv4 dotted-decimal
address or an IPv6 hexadecimal address.
af
input value; an integer that sets the address type searched for by the function and returned by
the function. af is either AF_INET (IPv4) or AF_INET6 (IPv6).
flags
input value; an integer that specifies the conditions for returning an address: IPv6-only,
IPv4-mapped if no IPv6 address found, or return an address only if the remote node name has
at least one IP address configured. See ai_flags underaddrinfo (page 64) for the ai_flags
values.
error_ptr
input and return value; a pointer to the error code returned by the getipnodebyname function.
error_num is set to one of the following values:
The specified host was not found.HOST_NOT_FOUND
A temporary, and possibly transient, error occurred, such as a failure of a server to
respond.
TRY_AGAIN
An unexpected server failure occurred which cannot be recovered.NO_RECOVERY
The specified hostname is valid, but the host does not have an IP address. Another type
of request to the name server for the domain might return an error.
NO_ADDRESS
Example
The address pointed to by hp, which is already in network order, can be used directly in a
sockaddr_in or sockaddr_in6 structure, as in the following example:
116 Library Routines