The sendmsg callable service sends messages on a socket.
Operation | Environment |
---|---|
Authorization: | Supervisor state or problem state, any PSW key |
Dispatchable unit mode: | Task or SRB |
Cross memory mode: | PASN = HASN |
AMODE (BPX2SMS): | 31-bit |
AMODE (BPX4SMS): | 64-bit |
ASC mode: | Primary mode |
Interrupt status: | Enabled for interrupts |
Locks: | Unlocked |
Control parameters: | All parameters must be addressable by the caller and in the primary address space. |
|
AMODE 64 callers use BPX4SMS with the same parameters. All addresses in the Message_hdr structure are doublewords.
The name of a fullword that contains the socket file descriptor for which the sendmsg is to be done.
The name of a field that contains the message header, which describes how the message is to be sent. In 64-bit mode, Message_hdr contains doubleword pointer subfields, and points to an Iov_struct structure that contains doubleword pointer and length subfields. See BPXYMSGH — Map the message header for more information about the format of this field.
The name of a field that contains information about how the data is to be sent. See BPXYMSGF — Map the message flags for more information about the format of this field.
The name of a field that contains the ALET for the IOV structure that is specified in Message_hdr.
The name of a field that contains the ALET for the buffers that are pointed to by the IOV structure that is specified in Message_hdr.
Return_code | Explanation |
---|---|
EACCES | For AF_UNIX sockets, search permission is denied for a component of the path prefix or write access to the named socket is denied. |
EAFNOSUPPORT | The address family that was specified in the message header is not the same as the address family that owns the socket. |
EBADF | A file descriptor that was not valid was supplied. The following reason codes can accompany the return code: JRFileDesNotInUse, JRFileNotOpen. |
ECONNRESET | Connection reset by peer. The following reason code can accompany the return code: JRSockNotCon. |
EINTR | A signal interrupted the sendmsg service before any data was written. The following reason code can accompany the return code: JRSockRdwrSignal. |
EINVAL | Data that was not valid was sent to the request.The following reason codes can accompany the return code: JRInvalidMsgh, JRSocketCallParmError, and JRSockNoName. |
EIO | There has been a network or transport failure. The following reason codes can accompany the return code: JRInetRecycled, JRPrevSockError. |
EMSGSIZE | The message is too large to be sent all at once, as the socket requires. The following reason code can accompany the return code: JRSockBufMax. |
ENOBUFS | A buffer could not be obtained. The following reason code can accompany the return code: JROutofSocketCells. |
ENOTCONN | The socket was not connected. The following reason code can accompany the return code: JRSocketNotCon. |
ENOTSOCK | Socket_descriptor does not refer to a valid socket descriptor. The following reason code can accompany the return code: JRMustBeSocket. |
EPIPE | An attempt was made to send a message to a socket that is shut down or closed. The following reason code can accompany the return code: JRSocketClosed. This error also generates a SIGPIPE signal. |
EWOULDBLOCK |
The following reason codes can accompany the return code: JRWouldBlock and JRTimeout. |
The name of a fullword in which the sendmsg service stores the reason code. The sendmsg service returns Reason_code only if Return_value is -1. Reason_code further qualifies the Return_code value. For the reason codes, see z/OS UNIX System Services Messages and Codes.
recvmsg (BPX2RMS, BPX4RMS) — Receive messages on a socket and store them in message buffers
There are no restrictions on the use of the sendmsg service.
For an example using this callable service, see BPX2SMS (sendmsg) example.