gethostbyname

Returns information about a host, given its name.

Library:LibC
Standard:BSD
Service:Networking

Syntax

  #include <netdb.h> 
   
  struct hostent *gethostbyname (
     const char   *name);
  

Parameters

name

(IN) Points to the official name of the host or an alias.

Return Values

If successful, returns a pointer to a structure of type hostent. Otherwise, returns NULL and sets h_errno to the following:

Decimal

Constant

Description

1

HOST_NOT_FOUND

No such host is known.

Remarks

The gethostbyname function accepts a pointer to a character string representing a hostname. If the name is a numeric address string for IP, it must be in dotted-decimal notation.

Calling any database routine overwrites the results of the last routine that this NLMâ„¢ application called.

See Also

gethostbyaddr