The following code gets the peer name, and then requests
the socket name. SOCKDESC was returned by a previous
call to BPX1SOC.
For the callable service, see
getsockname or getpeername (BPX1GNM, BPX4GNM) - Get the name of a socket or connected peer. For the data structure,
see
BPXYSOCK — Map SOCKADDR structure and constants. AMODE
64 callers use
BPX4GNM (getpeername or getsockname) example.
SPACE ,
CALL BPX1GNM, Get peername +
(SOCKDESC, Input: Socket Descriptor +
SOCK#GNMOPTGETPEERNAME, Input: Indicate getpeername +
SOCK#LEN+SOCK_SUN#LEN, Input: Length - Sockaddr +
SOCKADDR, Input: Sockaddr structure +
RETVAL, Return value: 0 or -1 +
RETCODE, Return code +
RSNCODE), Reason code +
VL,MF=(E,PLIST) ----------------------------------
SPACE ,
CALL BPX1GNM, Get sockname +
(SOCKDESC, Input: Socket Descriptor +
SOCK#GNMOPTGETSOCKNAME, Input: Indicate getpeername +
SOCK#LEN+SOCK_SUN#LEN, Input: Length - Sockaddr +
SOCKADDR, Input: Sockaddr structure +
RETVAL, Return value: 0 or -1 +
RETCODE, Return code +
RSNCODE), Reason code +
VL,MF=(E,PLIST) ----------------------------------