*DECK IPPSTAS
USETEXT TEXTIPL
PROC IPPSTAS (SOCKID, STATE, READ, WRITE, SOCKSTATUS);
*CALL COPYRITE CDCNET - COPYRIGHT CONTROL DATA. 1992.
# TITLE IPPSTAS - STATUS SOCKET #
BEGIN # IPPSTAS #
#
**** IPPSTAS STATUS SOCKET
*
* THIS PROCEDURE QUERYS THE STATUS OF A SOCKET. THE SOCKET STATE
* AND THE ABILITY TO CURRENTLY RECEIVE OR SEND DATA ARE THE STATUS
* VALUES RETURNED.
*
* PROC IPPSTAS
*
* ENTRY SOCKID = INTEGER VALUE OF A SOCKET.
*
* EXIT STATE = CURRENT STATE OF THE SOCKET AS DEFINED BY
* *CONNECTSTATE*.
* READ = BOOLEAN, TRUE IF DATA QUEUED.
* WRITE = BOOLEAN, TRUE IF NOT AT APPLICATION BLOCK
* LIMIT.
* SOCKSTATUS = COMPLETION STATUS
*
* METHOD CALL THE NAM INPUT HANDLER TO CHECK THE NETWORK.
* VERIFY THE SOCKET IS CONNECTED. IF THE SOCKET HAS
* DISCONNECTED FROM NAM, RETURN AN ABORT STATUS.
* SET *STATE* TO THE CURRENT SOCKET STATE, SET *READ*
* TO THE ACN$DATAV VALUE, SET WRITE TO TRUE IF THE
* CONNECTION IS NOT AT THE APPLICATION BLOCK LIMIT AS
* DEFINED IN THE ACN ENTRY FOR THE SOCKET.
#
#
**** PROC IPPSTAS - XREF LIST
#
XREF
BEGIN
PROC IPINITH; # NAM INPUT TRAFFIC HANDLER #
END
#
**
#
ITEM SOCKID I; # SOCKET IDENTIFIER #
ITEM STATE S:CONNECTSTATE; # SOCKET STATE #
ITEM READ B; # DATA AVAILABLE #
ITEM WRITE B; # WRITE ALLOWED #
ITEM SOCKSTATUS S:SOCKSTAT; # RETURNED SOCKET STATUS #
CONTROL EJECT;
#
**** START MAIN PROCEDURE
#
BLOCK = FALSE; # SET NAM HANDLER NOT TO WAIT #
IPINITH; # CALL NAM HANDLER #
SOCKSTATUS = S"OK";
READ = ACN$DATAV [SOCKID];
WRITE = (ACN$OBC [SOCKID] LS ACN$ABL [SOCKID]);
IF (ACN$ABORT [SOCKID])
THEN
BEGIN # CONNECTION ABORTED #
SOCKSTATUS = S"ABORT";
READ = FALSE;
WRITE = FALSE;
END
IF NOT ACN$CONNECT [SOCKID]
THEN
BEGIN
SOCKSTATUS = SOCKSTAT"INVALIDST";
READ = FALSE;
WRITE = FALSE;
END
STATE = ACN$STATE [SOCKID];
RETURN; # RETURN TO CALLER #
END # IPPSTAS #
TERM