|
Looking Up a Computer Name
NAME
gethostbyname - get network host entry
SYNOPSIS
#include <netdb.h>
extern int h_errno;
struct hostent
*gethostbyname(const char *name);
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]
name could be a name or dotted decimal address
Hosts can have many names in h_aliases
Hosts can have many addresses in h_addr_list
Addresses in h_addr_list are not strings
network order addresses ready to copy and use
|