Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This structure is used by functions to store information about a given host, such as host name, IP address, and so forth. An application should never attempt to modify this structure or to free anything inside the structure. Furthermore, only one copy of this structure is allocated per thread, and an application should therefore copy any information that it needs before issuing any other Windows Sockets API calls.

Syntax

struct hostent {
  char FAR* 
h_name;
  char FAR* FAR* 
h_aliases;
  short 
h_addrtype;
  short 
h_length;
  char FAR* FAR* 
h_addr_list;
};

Members

h_name

Official name of the host computer. If using the DNS or similar resolution system, it is the fully qualified domain name (FQDN) that caused the server to return a reply. If using a local hosts file, it is the first entry after the IP address.

h_aliases

Null-terminated array of alternate names.

h_addrtype

Type of address being returned.

h_length

Length of each address, in bytes.

h_addr_list

Null-terminated list of addresses for the host. Addresses are returned in network byte order. The macro h_addris defined to be h_addr_list[0]for compatibility with older software.

Requirements

Header winsock2.h
Windows Embedded CE Windows CE .NET 4.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

gethostbyaddr