Home |
Function gethostbyname |
Function gethostbynameFunction gethostbyname performs a DNS lookup on a given name: struct hostent * gethostbyname(char * name); ParametersnameNull-terminated string of the host name to look up. return valueReturns pointer to a hostent structure if successful, otherwise NULL. If an error occurred, call xn_getlasterror and xn_geterror_string to return the error value. Possible values for this function are:
Given a domain name string as a parameter, gethostbyname accesses the domain name server to return a pointer to a hostent structure, which contains address information. The pointer returned points to an entry in an internal host cache. The entries are allocated using the round robin method. Therefore, the information returned should be extracted immediately from the entry returned. For a description of the hostent structure, see section gethostbyaddr. DNS uses the UDP protocol to retrieve the information from the DNS server. Note that xn_set_server_list must have been called before this function can be used.
|