The WRITE macro writes data on a connected socket. The WRITE macro is similar to the SEND macro except that it does not have the control flags that can be used with SEND.
For datagram sockets, this macro writes the entire datagram, if it will fit into one TCP⁄IP buffer.
For stream sockets, the data is processed as streams of information with no boundaries separating the data. For example, if you want to send 1000 bytes of data, each call to the write macro can send 1 byte, 10 bytes, or the entire 1000 bytes. You should place the WRITE macro in a loop that cycles until all of the data has been sent.
| Authorization: | Supervisor state or problem state, any PSW key. |
| Dispatchable unit mode: | Task. |
| Cross memory mode: | PASN = HASN. |
| Amode: | 31-bit or 24-bit. Note: See "Addressability
mode (Amode) considerations" under CALL instruction API environmental restrictions and programming requirements.
|
| 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=WRITE--,S--=--+-number---+----------------------> +-address--+ +-*indaddr-+ '-(reg)----' >--,NBYTE--=--+-number---+--,BUF--=--+-address--+---------------> +-address--+ +-*indaddr-+ +-*indaddr-+ '-(reg)----' '-(reg)----' >--+------------------------+--,ERRNO--=--+-address--+----------> '-,ALET--=--+-address--+-' +-*indaddr-+ +-*indaddr-+ '-(reg)----' '-(reg)----' >--,RETCODE--=--+-address--+--+---------------------------+-----> +-*indaddr-+ +-,ECB--=--+-address--+-----+ '-(reg)----' | +-*indaddr-+ | | '-(reg)----' | '-,REQAREA--=--+-address--+-' +-*indaddr-+ '-(reg)----' >--+-------------------------+--+------------------------+----->< '-,ERROR--=--+-address--+-' '-,TASK--=--+-address--+-' +-*indaddr-+ +-*indaddr-+ '-(reg)----' '-(reg)----'
If a nonzero ALET is specified, the ALET must represent a valid entry in the dispatchable unit access list (DU-AL) for the task issuing this call. Note that ALETs can be specified only for synchronous socket calls (for example, ECB/REQAREA cannot be specified). An exception to this is an ALET representing a SCOPE=COMMON data space.
This macro writes up to NBYTE bytes of data. If there is not enough available buffer space for the socket data to be transmitted, and the socket is in blocking mode, WRITE blocks the caller until additional buffer space is available. If the socket is in nonblocking mode, WRITE returns a -1 and sets ERRNO to 35 (EWOULDBLOCK). See FCNTL or IOCTL for a description of how to set the nonblocking mode.