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


GETNAMEINFO

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

The GETNAMEINFO call returns the node name and service location of a socket address that is specified in the call. On successful completion, GETNAMEINFO returns the node and service named, if requested, in the buffers provided.

The following requirements apply to this call:
Figure 1. GETNAMEINFO call instruction example
    WORKING-STORAGE SECTION.
        01  SOC-FUNCTION      PIC X(16)  VALUE IS 'GETNAMEINFO'.
        01  NAMELEN           PIC 9(8) BINARY.
        01  HOST              PIC X(255).
        01  HOSTLEN           PIC 9(8) BINARY.
        01  SERVICE           PIC X(32).
        01  SERVLEN           PIC 9(8) BINARY.
        01  FLAGS             PIC 9(8) BINARY VALUE 0.
        01  NI-NOFQDN         PIC 9(8) BINARY VALUE 1.
        01  NI-NUMERICHOST    PIC 9(8) BINARY VALUE 2.
        01  NI-NAMEREQD       PIC 9(8) BINARY VALUE 4.
        01  NI-NUMERICSERVER  PIC 9(8) BINARY VALUE 8.
        01  NI-DGRAM          PIC 9(8) BINARY VALUE 16.
        01  NI-NUMERICSCOPE   PIC 9(8) BINARY VALUE 32.




    * IPv4 socket structure.
        01  NAME.
            03  FAMILY      PIC 9(4) BINARY.
            03  PORT        PIC 9(4) BINARY.
            03  IP-ADDRESS  PIC 9(8) BINARY.
            03  RESERVED    PIC X(8).

    * IPv6 socket structure.
        01  NAME.
            03  FAMILY      PIC 9(4) BINARY.
            03  PORT        PIC 9(4) BINARY.
            03  FLOWINFO    PIC 9(8) BINARY.
            03  IP-ADDRESS.
                10 FILLER   PIC 9(16) BINARY.
                10 FILLER   PIC 9(16) BINARY.
            03  SCOPE-ID    PIC 9(8) BINARY.

        01  ERRNO           PIC 9(8) BINARY.
        01  RETCODE         PIC S9(8) BINARY.
 
    PROCEDURE DIVISION.

         MOVE 28 TO NAMELEN.
         MOVE 255 TO HOSTLEN.
         MOVE 32 TO SERVLEN.
         MOVE NI-NAMEREQD TO FLAGS.
         CALL 'EZASOKET' USING SOC-FUNCTION NAME NAMELEN HOST 
               HOSTLEN SERVICE SERVLEN FLAGS ERRNO RETCODE.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014