🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.os2.programmer.misc
Article #233

Re: Named Pipes DOS Access Question

#233
From: Mikael Wahlgren
Date: Thu, 14 Oct 1993 21:43
34 lines
2235 bytes
kbennett@access.digex.net (Keith R. Bennett) writes:

>The writing (OS/2) process writes 100 strings to the pipe in a fast
>loop.  The reading (DOS) process reads from the pipe, also in a
>fast loop.  I have specified the NP_WAIT flag when creating the
>pipe.

>My problem is this: after reading some strings from the pipe
>correctly, the fread() of the DOS process returns 0, indicating that
>it failed to read anything from the pipe.

>Why is this?  Is the DOS process reading faster than the OS/2
>process is writing?  I would like the fread() to be blocking,
>and that's why I used NP_WAIT.  Does this parameter work only
>in OS/2 sessions?

A pipe have two logical ends (server and client).  When you create the pipe
with the NP_WAIT flag that is only valid for the SERVER end of the pipe.  How
the client end of the pipe is handled is entirely decided by the client
program.

But I don't quite understand what is happening in your case, because all
pipes are OPENed in blocking mode as default and for a DOS program it is
quite hard to change from blocking to non-blocking mode (so perhaps you should
be lucky...:-).

>What is the best way to deal with this situation?  Do I have to loop
>until the fread returns something?  Is there any kind of DosSleep()
>I can use in a DOS session?

Yes there is.  Don't remember it right now though.  Recommend you to look
in the interrupt-list.

Mikael Wahlgren
Technical Details
Message-ID: <d9mikael.750634984@dtek.chalmers.se>
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!pipex!sunic!news.chalmers.se!dtek.chalmers.se!d9mikael
References: <29k648$ipc@access.digex.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cd94,78347157620d8aa
X-Google-Attributes: gid10cd94,public
X-Google-Thread: 11307a,78347157620d8aa
X-Google-Attributes: gid11307a,public
X-Google-ArrivalTime: 1993-10-14 16:06:38 PST
Newsgroups: comp.os.os2.programmer.misc,bit.listserv.os2-l
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!pipex!sunic!news.chalmers.se!dtek.chalmers.se!d9mikael
From: d9mikael@dtek.chalmers.se (Mikael Wahlgren)
Subject: Re: Named Pipes DOS Access Question
Message-ID: <d9mikael.750634984@dtek.chalmers.se>
Sender: news@news.chalmers.se
Nntp-Posting-Host: hacke12.dtek.chalmers.se
Organization: Chalmers University of Technology, Gothenburg Sweden
References: <29k648$ipc@access.digex.net>
Date: Thu, 14 Oct 1993 21:43:04 GMT
Lines: 34