The following code sends a message on a socket. SOCKDESC
was returned from a previous call to BPX1SOC. For the callable
service, see
sendmsg (BPX2SMS, BPX4SMS) — Send messages on a socket. For the data structures,
see
BPXYSOCK — Map SOCKADDR structure and constants,
BPXYIOV — Map the I/O vector structure, and
BPXYMSGH — Map the message header.
AMODE 64 callers use
BPX4SMS (sendmsg) example.
XC MSGH(MSGH#LENGTH),MSGH Clear msgh
LA R2,SOCKADDR
ST R2,MSGHNAMEPTR Store the address of sockaddr
LA R2,SOCK#LEN+SOCK_SUN#LEN
ST R2,MSGHNAMELEN
LA R2,IOV
ST R2,MSGHIOVPTR
MVI MSGHIOVNUM,1
*
LA R2,BUFFERA
ST R2,IOV_BASE
LA R2,16
ST R2,IOV_LEN
MVC BUFFERA(16),=CL16'Here is the data'
*
CALL BPX2SMS, Send a message on a socket +
(SOCKDESC, Input: Socket Descriptor +
MSGH, Input: Address of BPXYMSGH +
MSG_FLAGS, Input: Flags +
PRIMARYALET, Input: Alet of the iov +
PRIMARYALET, Input: Alet of the buffers in iov +
RETVAL, Return value: 0 or -1 +
RETCODE, Return code +
RSNCODE), Reason code +
VL,MF=(E,PLIST) ----------------------------------