*DECK IPPGETI
USETEXT TEXTIPL
PROC IPPGETI (SOCKID, ADDRESS, SOCKSTATUS);
*CALL COPYRITE CDCNET - COPYRIGHT CONTROL DATA. 1992.
# TITLE IPPGETI - GET SOCKET INFORMATION #
BEGIN # IPPGETI #
#
**** IPPGETI GET SOCKET INFORMATION.
*
* THIS PROCEDURE OBTAINS THE IP ADDRESS AND PORT NUMBER OF A SOCKET
* WHICH HAS BEEN BOUND.
*
* PROC IPPGETI
*
* ENTRY SOCKID = INTEGER VALUE OF A SOCKET.
*
* EXIT ADDRESS = 4 WORD ARRAY OF ADDRESS.
* SOCKSTATUS = COMPLETION STATUS
*
* METHOD VERIFY THE SOCKET IS CONNECTED AND THAT IT IS IN THE
* BOUND STATE. IF THE SOCKET HAS DISCONNECTED, RETURN AN
* ABORT STATUS FOR CONNECTION. COPY THE IP ADDRESS FROM
* THE SOCKET TO *ADDRESS*.
#
#
**
#
ITEM SOCKID I; # SOCKET IDENTIFIER #
ARRAY ADDRESS [00:00] S(1);; # IP ADDRESS/PORT OF SOCKET #
ITEM SOCKSTATUS S:SOCKSTAT; # RETURNED SOCKET STATUS #
CONTROL EJECT;
#
**** START MAIN PROCEDURE
#
IF (ACN$ABORT [SOCKID])
THEN
BEGIN # CONNECTION ABORTED #
SOCKSTATUS = S"ABORT";
RETURN;
END
IF ACN$STATE [SOCKID] NQ S"BOUND"
THEN
BEGIN
SOCKSTATUS = S"INVALIDST";
RETURN;
END
P<IP$ADDR$REC> = LOC (ADDRESS);
IP$IPFIU [0] = ACN$SIPFIU [SOCKID];
IP$IPNET [0] = ACN$SIPNET [SOCKID];
IP$IPHOST [0] = ACN$SIPHOST [SOCKID];
IP$UDPORT [0] = ACN$SIUPORT [SOCKID];
SOCKSTATUS = S"OK";
RETURN; # RETURN TO CALLER #
END # IPPGETI #
TERM