BPX4SMS (sendmsg) example
The following code sends a message on a socket. SOCKDESC
was returned from a previous call to BPX4SOC. 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 31 callers use BPX2SMS (sendmsg) example.
XC MSGH(MSGH#LENGTH),MSGH Clear msgh
LA R2,SOCKADDR
STG R2,MSGHNAMEPTR Store the address of sockaddr
LA R2,SOCK#LEN+SOCK_SUN#LEN
ST R2,MSGHNAMELEN
LA R2,IOV
STG R2,MSGHIOVPTR
MVI MSGHIOVNUM,1
*
LA R2,BUFFERA
STG R2,IOV_BASE
LA R2,16
STG R2,IOV_LEN
MVC BUFFERA(16),=CL16'Here is the data'
*
CALL BPX4SMS, 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 +
MF=(E,PLIST) ----------------------------------