GETHOSTBYNAME

The GETHOSTBYNAME call returns the alias name and the internet address of a host whose domain name is specified in the call. A given host can have multiple alias names and multiple host internet addresses.

The debugging tools sockets interface tries to resolve the host name through a name server.

Example of GETHOSTBYNAME call

SOC_FUNCTION DC   CL16'GETHOSTBYNAME'
NAMELEN      DS   F
NAME         DS   CL255
HOSTENT      DS   F
RETCODE      DS   F
 
             CALL DFHSOKET,(SOC_FUNCTION,NAMELEN,NAME,HOSTENT,RETCODE)

Input parameters

SOC_FUNCTION
A 16-byte character field containing 'GETHOSTBYNAME'. The field is left-justified and padded on the right with blanks.
NAMELEN
A value set to the length of the host name.
NAME
A character string, up to 255 characters, set to a host name. This call returns the address of the HOSTENT structure for this name.

Output parameters

HOSTENT
A fullword binary field that contains the address of the HOSTENT structure.
RETCODE
A fullword binary field that returns one of the following:
Value
Description
0
Successful call
-1
An error occurred

The HOSTENT structure

Figure 1. HOSTENT structure returned by the GETHOSTYBYNAME call
This is an illustration of the HOSTENT structure which is returned by the GETHOSTBYNAME call
GETHOSTBYNAME returns the HOSTENT structure shown in Figure 1. This structure contains:
  • The address of the host name that is returned by the call. The name length is variable and is ended by X'00'.
  • The address of a list of addresses that point to the alias names returned by the call. This list is ended by the pointer X'00000000'. Each alias name is a variable length field ended by X'00'.
  • The value returned in the FAMILY field is always 2 for AF_INET.
  • The length of the host internet address returned in the HOSTADDR_LEN field is always 4 for AF_INET.
  • The address of a list of addresses that point to the host internet addresses returned by the call. The list is ended by the pointer X'00000000'. If the call cannot be resolved, the HOSTENT structure contains the ERRNO 10214.


dfhtn0s.html | Timestamp icon Last updated: Monday, 5 June 2017