First page Back Continue Last page Overview Graphics
Historical Name-vs-Address Translation Functions
Name to address
struct hostent *gethostbyname(const char *name);
Address to name
struct hostent *gethostbyaddr(const char *addr,
int len, int type);
Host entry structure
struct hostent {
char *h_name; /* official name */
char **h_aliases; /* alias list */
char h_addrtype; /* type of address: AF_xxx */
int h_length; /* length of the address: 4 for IPv4 */
char **h_addr_list; /* list of addresses from name server */
};
Issues
- The structure itself is af-independent, but gethostbyname().
- Unflexible – no searching options
- Not MT-safe
Notes: