gethostbyname

gethostbyname retrieves host information corresponding to a host name from a host database on a DNS server.

Syntax

struct hostent* gethostbyname(
    __in const char *name
);

Parameters

name

Null terminated ASCII string that contains the name of the host to retrieve information for.

Return Values

A pointer to the host information if the function succeeds

NULL if the functions fails

WSAGetLastError can be called to determine the cause.

Remarks

Because of the standard usage, gethostbyname must return a pointer to a global structure. This means that the information returned from this function should be called before any other call is made to gethostbyname by the same process.

gethostname returns an ASCII string that can be used with gethostbyname.

IntervalZero.com | Support | Give Feedback