GethostByname returns a pointer to the Hostent data structure:
// from Winsock.h
Struct hostent {
Char far * h_name; / * official host name * /
Char Far * Far * h_aliases; / * Alias list * /
Short h_addrtype; / * Host address type * /
Short h_length; / * address length * /
Char Far * Far * h_addr_list; / * Address List * /
}; This is a typical underlying API data structure, many people are not very familiar with it. In fact, Hostent is a growing data structure, h_name is the host name, and the value in the example program is "zxn.hangwire.sdb". There is no alias (h_aliases). h_addrtype is the address type (or also called an address family), in the example of the value of 2 (AF_INET = Internet, other content see Winsock.h). H_length is the length of each address, in bytes. Since the length of the IP address is 4 bytes, the value in the example program is 4, h_addr_list is the beginning point of the address array, and one is stored, the end is a NULL. Each x.y.z.w digit accounts for one byte. In order to format the IP address into X.y.z.w, you must copy the address number first to a data structure called SockAddr, and then call a special function INT_NTOA.