BPX4CON (connect) example
The following code connects to a socket. SOCKDESC was
returned by a previous call to BPX4SOC, and SOCKADDR contains the
name of the peer, possibly obtained by a call to BPX4GNM. For the
callable service, see connect (BPX1CON, BPX4CON) — Establish a connection between two sockets. For the
data structure, see BPXYSOCK — Map SOCKADDR structure and constants. AMODE 31 callers
use BPX1CON (connect) example.
SPACE ,
MVI SOCK_LEN,12 Store the length of the address
MVI SOCK_FAMILY,AF_UNIX Set the domain to AF_UNIX
MVC SOCK_SUN_NAME(12),=CL12'/tmp/socket1' Set the name
CALL BPX4CON, Connect to a socket +
(SOCKDESC, Input: Socket Descriptor +
=A(SOCK#LEN+SOCK_SUN#LEN), Input: Length - Sockaddr +
SOCKADDR, Input: Sockaddr structure +
RETVAL, Return value: 0 or -1 +
RETCODE, Return code +
RSNCODE), Reason code +
MF=(E,PLIST) ----------------------------------