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:
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. |
>>-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).
- 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.