z/OS Communications Server: IP Sockets Application Programming Interface Guide and Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Parameter values returned to the application

z/OS Communications Server: IP Sockets Application Programming Interface Guide and Reference
SC27-3660-00

HOSTENT
A fullword containing the address of the HOSTENT structure.
RETCODE
A fullword binary field that returns one of the following values:
Value
Description
0
Successful call.
-1
Check ERRNO for an error code.

GETHOSTBYADDR returns the HOSTENT structure shown in Figure 1.

Figure 1. HOSTENT structure that is returned by the GETHOSTBYADDR call
Hostent returned by the GETHOSTBYADDR call consists of the addresses of host name, alias list, family, host address length, and host address list.
GETHOSTBYADDR returns the HOSTENT structure shown in figure Figure 1. The HOSTENT structure is a tasks's serially reusable storage area. It should not be used or referenced between MVS™ tasks. The storage is freed when the task terminates. The assembler mapping of the structure is defined in macro EZBREHST, which is installed in the data set specified on your SMP/E DDDEF for MACLIB. The EZBREHST assembler macro is stored in the SYS1.MACLIB library. The macro defines the resolver hostent (host entry), address information (addrinfo) mappings, and services return codes. 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 IP 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 IP 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.

The HOSTENT structure uses indirect addressing to return a variable number of alias names and IP addresses. If you are coding in PL/I or assembler language, this structure can be processed in a relatively straight-forward manner. If you are coding in COBOL, this structure may be difficult to interpret. You can use the subroutine EZACIC08 to simplify interpretation of the information returned by the GETHOSTBYADDR and GETHOSTBYNAME calls. For more information about EZACIC08, see EZACIC08.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014