gethostbyname Function

C

struct hostent * gethostbyname(
    char * name
);

Preconditions

None.

Parameters

ParametersDescription
nameThe name of the host to be found.

Returns

  • The hostent structure if function is successful.

  • NULL if there is an error.

Remarks

This function supports IPv4 only. h_errno will be set to:

  • TRY_AGAIN if the DNS query is currently in progress.

  • HOST_NOT_FOUND if the DNS query could not find a host name.

  • NO_RECOVERY if the DNS query had an unrecoverable error.