The following code gets and then sets socket options.
SOCKDESC was returned on a previous call to BPX4SOC.
For the callable service, see
getsockopt or setsockopt (BPX1OPT, BPX4OPT) — Get or set options associated with a socket.
For the data structure, see
BPXYSOCK — Map SOCKADDR structure and constants.
AMODE 31 callers use
BPX1OPT (getsockopt or setsockopt) example.
MVC BUFLENA,=A(L'BUFFERA)
CALL BPX4OPT, Get socket options +
(SOCKDESC, Input: Socket Descriptor +
=A(SOCK#OPTOPTGETSOCKOPT), Input: Indicate Get socket +
SOCK#SOL_SOCKET, Input: Level +
SOCK#SO_TYPE, Input: Option name +
BUFLENA, Input: Length - option value +
BUFFERA, Input: Option value +
RETVAL, Return value: 0 or -1 +
RETCODE, Return code +
RSNCODE), Reason code +
MF=(E,PLIST) ----------------------------------
SPACE ,
MVC BUFLENA,=A(4) SO_OOBINLINE has length=4
CALL BPX4OPT, Set socket options +
(SOCKDESC, Input: Socket Descriptor +
=A(SOCK#OPTOPTSETSOCKOPT), Input: Indicate set socket +
SOCK#SOL_SOCKET, Input: Level +
SOCK#SO_TYPE, Input: Option name +
BUFLENA, Input: Length - option value +
SOCK#SO_OOBINLINE, Input: Option value +
RETVAL, Return value: 0 or -1 +
RETCODE, Return code +
RSNCODE), Reason code +
MF=(E,PLIST) ----------------------------------