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


FCNTL

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

The blocking mode for a socket can be queried or set to nonblocking using the FNDELAY flag. You can query or set the FNDELAY flag even though it is not defined in your program.

See IOCTL for another way to control socket blocking.

The following requirements apply to this call:
Read syntax diagramSkip visual syntax diagram
>>-EZASMI--TYPE=FCNTL--,S--=--+-number---+---------------------->
                              +-address--+   
                              +-*indaddr-+   
                              '-(reg)----'   

>--,COMMAND--=--+-'F_GETFL'-+--,REQARG--=--+-address--+--------->
                +-'F_SETFL'-+              +-*indaddr-+   
                +-address---+              '-(reg)----'   
                +-*indaddr--+                             
                '-(reg)-----'                             

>--,ERRNO--=--+-address--+--,RETCODE--=--+-address--+----------->
              +-*indaddr-+               +-*indaddr-+   
              '-(reg)----'               '-(reg)----'   

>--+---------------------------+--+-------------------------+--->
   +-,ECB--=--+-address--+-----+  '-,ERROR--=--+-address--+-'   
   |          +-*indaddr-+     |               +-*indaddr-+     
   |          '-(reg)----'     |               '-(reg)----'     
   '-,REQAREA--=--+-address--+-'                                
                  +-*indaddr-+                                  
                  '-(reg)----'                                  

>--+------------------------+----------------------------------><
   '-,TASK--=--+-address--+-'   
               +-*indaddr-+     
               '-(reg)----'     

Keyword
Description
S
Input parameter. A value or the address of a halfword binary number specifying the socket descriptor for the socket that you want to unblock or query.
COMMAND
Input parameter. A fullword binary field or a literal that sets the FNDELAY flag to one of the following values:
Value
Description
3 or 'F_GETFL'
Query the blocking mode for the socket.
4 or 'F_SETFL'
Set the mode to nonblocking for the socket. REQARG is set by TCP⁄IP.

The FNDELAY flag sets the nonblocking mode for the socket. If data is not present on calls that can block (READ, READV, and RECV), the call returns a -1, and ERRNO is set to 35 (EWOULDBLOCK).

Note: Values for COMMAND that are supported by the z/OS® UNIX System Services FCNTL callable service are supported also. see z/OS UNIX System Services Programming: Assembler Callable Services Reference for more information.
REQARG
A fullword binary field containing a mask that TCP⁄IP uses to set the FNDELAY flag.
  • If COMMAND is set to 3 (query), the REQARG field should be set to 0.
  • If COMMAND is set to 4 (set),
    • Set REQARG to 4 to turn the FNDELAY flag on. This places the socket in nonblocking mode.
    • Set REQARG to 0 to turn the FNDELAY flag off. This places the socket in blocking mode.
ERRNO
Output parameter. A fullword binary field. If RETCODE is negative, ERRNO contains a valid error number. Otherwise, ignore the ERRNO field.

See Socket call error return codes for information about ERRNO return codes.

RETCODE
Output parameter. A fullword binary field that returns one of the following values:
  • If COMMAND was set to 3 (query), a bit string is returned.
    • If RETCODE contains X'00000004', the socket is nonblocking. The FNDELAY flag is on.
    • If RETCODE contains X'00000000', the socket is blocking. The FNDELAY flag is off.
  • If the COMMAND field was 4 (set), a successful call returns 0 in RETCODE. For either COMMAND, a RETCODE of -1 indicates an error. Check ERRNO for the error number.
ECB or REQAREA
Input parameter. This parameter is required if you are using APITYPE=3. It points to a 104-byte field containing:
For ECB
A 4-byte ECB posted by TCP/IP when the macro completes.
For REQAREA
A 4-byte user token (set by you) that is presented to your exit when the response to this function request is complete.
For ECB/REQAREA
The last 100 bytes is a storage field used by the interface to save the state information.
Note: This storage must not be modified until the macro function has completed and the ECB has been posted, or the asynchronous exit has been driven.
ERROR
Input parameter. The location in your program to receive control when the application programming interface (API) processing module cannot be loaded.
TASK
Input parameter. The location of the task storage area in your program.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014