The following code does a bind to associate the best
source address for the provided destination IP address with a socket.
SOCKDESC was previously set by a call to BPX1SOC. For the callable
service, see
bind2addrsel (BPX1BAS, BPX4BAS) — Bind the socket descriptor to the best source address. For the data structure,
see
BPXYSOCK — Map SOCKADDR structure and constants.
SPACE ,
Store the length of the address
MVI SOCK_LEN,=A(SOCK#LEN+SOCK_SIN6#LEN)
MVI SOCK_FAMILY,AF_INET6 Set the domain to AF_INET6
MVC SOCK_SIN6_ADDR,=XL16'00A100B200C300D400E500F61234ABCD'
CALL BPX1BAS, Bind with source address selection+
(SOCKDESC, Input: Socket Descriptor +
=A(SOCK#LEN+SOCK_SIN6#LEN), Input:Length - Sockaddr +
SOCKADDR, Input: Sockaddr structure +
RETVAL, Return value: 0 or -1 +
RETCODE, Return code +
RSNCODE), Reason code +
VL,MF=(E,PLIST) ----------------------------------