z/OS Communications Server: IP CICS Sockets Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


BIND call

z/OS Communications Server: IP CICS Sockets Guide
SC27-3649-00

In a typical server program, the BIND call follows a SOCKET call and completes the process of creating a new socket.

The BIND call can either specify the required port or let the system choose the port. A listener program should always bind to the same well-known port, so that clients know what socket address to use when attempting to connect.

Even if an application specifies a value of 0 for the IP address on the BIND, the system administrator can override that value by specifying the BIND parameter on the PORT reservation statement in the TCP/IP profile. This has a similar effect to the application specifying an explicit IP address on the BIND macro. For more information, see z/OS Communications Server: IP Configuration Reference.

In the AF_INET or AF_INET6 domain, the BIND call for a stream socket can specify the networks from which it is willing to accept connection requests. The application can fully specify the network interface by setting the IP-ADDRESS field to the Internet address of a network interface. Alternatively, the application can use a wildcard to specify that it wants to receive connection requests from any network interface. This is done by setting the IP-ADDRESS field to the value of INADDR-ANY or IN6ADDR-ANY.

The following requirements apply to this call:
Requirement Description
Authorization: Supervisor state or problem state, any PSW key
Dispatchable unit mode: Task
Cross memory mode: PASN = HASN
Amode: 31-bit or 24-bit
ASC mode: Primary address space control (ASC) mode
Interrupt status: Enabled for interrupts
Locks: Unlocked
Control parameters: All parameters must be addressable by the caller and in the primary address space

Figure 1 shows an example of BIND call instructions.

Figure 1. BIND call instruction example
    WORKING-STORAGE SECTION.
        01  SOC-FUNCTION    PIC X(16)  VALUE IS 'BIND'.
        01  S               PIC 9(4) BINARY.
    *                                                                 
    * IPv4 Socket Address 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 Address Structure.                                  
    *                                                                 
        01  NAME.                                                    
            03  FAMILY      PIC 9(4) BINARY.                         
            03  PORT        PIC 9(4) BINARY.                         
            03  FLOW-INFO   PIC 9(8) BINARY.                         
            03  IP-ADDRESS.                                          
                05  FILLER  PIC 9(16) BINARY.                        
                05  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.
         CALL 'EZASOKET' USING SOC-FUNCTION S NAME ERRNO RETCODE.

For equivalent PL/I and assembler language declarations, see Converting parameter descriptions.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014