HP3000-L Archives

January 2003, Week 2

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Roy Brown <[log in to unmask]>
Reply To:
Roy Brown <[log in to unmask]>
Date:
Tue, 14 Jan 2003 16:01:24 -0000
Content-Type:
text/plain
Parts/Attachments:
text/plain (51 lines)
---- Original Message ----
From: "Per Ostberg" <[log in to unmask]>
To: <[log in to unmask]>
Sent: Tuesday, January 14, 2003 2:31 PM
Subject: [HP3000-L] Message File programming

> Greetings
> I'm having problems reading from a message file. My program is
> supposed to answer different types of requests (from a socket). One
> of the requests involves reading a message-file. The problem is that
> the messagefile may be empty and the writer may not be running, but I
> would still like to return from FREAD (so I can reply that there are
> no messages, and go on with other requests).
> What aoptions should I use in FOPEN for my FREAD to always return?
> Should I use FCONTROL( ,45,0)? IOWAIT?


I think what you want is an FCONTROL(filenum,4,waittime); nothing special on
the FOPEN or the FREAD as far as timing out or not is concerned.

In this FCONTROL, you set a waittime (U16) as the time you will wait, in
seconds, for a response.

You only need to issue this once for your FOPENed message file, and it will
stay in force until changed; you don't need it once per FREAD.

waittime = 0 restores 'no timeout'.

You can tell if the FREAD was terminated on the timeout, when the writer is
running, as it will return CCL(1) in these circumstances. And FCHECK will give
22, Software Timeout.

You only actually need FCONTROL 4 for the first FREAD on your message file, or
if no writer is running. (But as you don't know if this is the case or not, in
practice you always need it).

But in other than these cases, the FREAD will return immediately on EOF
anyway, with CCG(0).

Which is what FCONTROL 45 is there to prevent; it's actually the exact
opposite of what you want, as it's designed to ensure that an FREAD *does*
wait until a record appears (or until the timeout kicks in).

Roy Brown

Posting with the OEnemy, tamed by OE-QuoteFix 1.17.6
http://jump.to/oe-quotefix

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2