HP-UX Reference (11i v1 00/12) - 3 Library Functions A-M (vol 6)

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man3/!!!intro.3c
________________________________________________________________
___ ___
g
gethostent(3N) gethostent(3N)
NAME
gethostent(), gethostbyaddr(), gethostbyname(), sethostent(), endhostent() - get network host entry
SYNOPSIS
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
struct hostent *gethostent(void);
struct hostent *gethostbyname(const char *name);
struct hostent *gethostbyaddr(const char *addr,
int len,
int type);
_XOPEN_SOURCE_EXTENDED only
struct hostent *gethostbyaddr(const void *addr,
size_t len,
int type);
int sethostent(int stayopen);
int endhostent(void);
_XOPEN_SOURCE_EXTENDED only
void sethostent(int stayopen);
void endhostent(void);
MULTITHREAD USAGE
Thread Safe: Yes
Cancel Safe: Yes
Async-cancel Safe: No
Async-signal Safe: No
These functions can be called safely in a Multithreaded environment. They may be cancellation points in
that they call functions that are cancel points.
DESCRIPTION
The gethostent() , gethostbyname()
, and gethostbyaddr() functions each return a pointer
to a structure of type
hostent, defined as follows in <netdb.h>:
struct hostent {
char *h_name;
char **h_aliases;
int h_addrtype;
int h_length;
char **h_addr_list;
};
#define h_addr h_addr_list[0]
The members of this structure are:
h_name The official name of the host.
h_aliases A null-terminated array of alternate names for the host.
h_addrtype The type of address being returned; always AF_INET.
h_length The length, in bytes, of the address.
h_addr_list A null-terminated array of network addresses for the host.
h_addr The first address in h_addr_list ; this is for compatibility with previous HP-
UX implementations where a struct hostent contains only one network
address per host.
Section 3302 1 HP-UX Release 11i: December 2000
___
___