Subject: | |
From: | |
Reply To: | |
Date: | Fri, 16 Aug 1996 13:31:46 -0700 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
This is a multi-part message in MIME format.
--------------33288769CF
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
A Server on the 3000 that is waiting for I/O from more than one place, including Call sockets,
virtual connections, and local message files. The clients are various P.C's, local processes, and
Sun's(UNIX.
This is done using the "IOWAIT" intrinsic in conjuntion with "FCONTROL" and "IPCCONTROL"
intrinsic's to turn the nowait option on before doing a read .
Then when "FREAD" or "IPCRECV" is called it won't wait for I/O to complete, but the read is
posted(first half of a read).
Then call the (second half of the read) "IOWAIT" intrinsic with file number zero to wait for I/O
on all reads posted, including NETWORK reads.
Then when I/O completes the "IOWAIT" intrinsic will return the file number of the completed I/O.
I have snipped out the main loop of this server as a (COBOL) example of
doing this.
--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Michael Anderson,
_/_/_/_/_/ _/_/_/ _/_/ _/ _/_/ Systems Programmer/Analyst
_/ _/ _/ _/_/ _/ TIW Corporation
_/ _/ _/_/ _/_/ Houston Texas
_/ _/_/_/ _/ _/ http://www.tiwtools.com
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
--------------33288769CF
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="MAIN1"
CALL "STARTUP".
DISPLAY THIS-PROG "Started...".
*========== Main loop ==========*
1000-MAIN.
D DISPLAY THIS-PROG "1000-MAIN".
* Setup CS-TABLE (in case anything has changed)
CALL "SETUPCS".
* Wait for any I/O completion
D DISPLAY THIS-PROG " Wait for response".
MOVE ZERO TO LONG-FNUM I.
CALL INTRINSIC "IOWAIT" USING
\0\ CMD-RECORD I GIVING SHORT-FNUM.
* Save the condition code
IF CC > ZERO MOVE 1 TO COND-CODE.
IF CC < ZERO MOVE -1 TO COND-CODE.
IF CC = ZERO MOVE 0 TO COND-CODE.
D MOVE SHORT-FNUM TO DISP-SN4.
D DISPLAY THIS-PROG "I/O completed on" DISP-SN4.
D MOVE COND-CODE TO DISP-SN4.
D DISPLAY THIS-PROG "Condition code=" DISP-SN4.
* See if command file
D DISPLAY THIS-PROG "See if command file".
IF SHORT-FNUM = CMD-FILE
D DISPLAY THIS-PROG "Go process command file record"
CALL "PROCCMD"
GO TO 1000-MAIN.
* See if call descriptor (lookup in CS-TABLE)
D DISPLAY THIS-PROG "See if call descriptor".
MOVE 1 TO CS.
PERFORM UNTIL CS > CS-END OR LONG-FNUM = CS-DESCRIPTOR (CS)
ADD 1 TO CS
END-PERFORM.
IF CS NOT GREATER THAN CS-END
D MOVE SHORT-FNUM TO DISP-SN4
D DISPLAY THIS-PROG "Process call descriptor" DISP-SN4
CALL "PROCCS"
GO TO 1000-MAIN.
* See if virtual connection (lookup in VC-TABLE)
D DISPLAY THIS-PROG "See if virtual connection".
MOVE 1 TO VC.
PERFORM UNTIL VC > VC-END OR LONG-FNUM = VC-DESCRIPTOR (VC)
ADD 1 TO VC
END-PERFORM.
IF VC NOT GREATER THAN VC-END
D MOVE SHORT-FNUM TO DISP-SN4
D DISPLAY THIS-PROG "Process virtual connection" DISP-SN4
CALL "PROCVC"
GO TO 1000-MAIN.
* Don't know what it's for - ignore it
MOVE SHORT-FNUM TO DISP-SN4.
MOVE SPACES TO LOG-TEXT.
STRING "Unknown I/O completion on" DISP-SN4
DELIMITED BY SIZE INTO LOG-TEXT.
CALL "WRITELOG".
D DISPLAY THIS-PROG "Ignored I/O completion for" DISP-SN4.
GO TO 1000-MAIN.
--------------33288769CF--
|
|
|