gethostbyname

gethostbyname returns a host address corresponding to a host name.

Syntax

struct hostent* gethostbyname(
    const char *name
);

Parameters

name

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

Return Value

A pointer to the host information if the function succeeds

NULL if the functions fails

WSAGetLastError can be called to determine the cause.

Remarks

Since the RT-TCP/IP stack does not support DNS protocol, only name-to-address translations, which don’t require dynamic name resolution, are supported.

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.

Requirements

Minimum Supported Version RTX64 2013
Header Winsock2.h
Library RtTcpip.lib