Article View: comp.os.os2.programmer
Article #2408Re: Programming with named pipes, again
From: Peter Michalica
Date: Mon, 11 Feb 1991 18:15
Date: Mon, 11 Feb 1991 18:15
47 lines
2470 bytes
2470 bytes
In article <1991Feb04.070011.7873@eecs.wsu.edu> wbonner@yoda.eecs.wsu.edu (Wim Bonner) writes:
>I've got my program that uses named pipes working wonderfully from local on my
>machine.
> ......
>when I do a DosMakeNmPipe() with the file name being "/pipe/dfa/config.dfa"
>everything works fine. When I add the name of the server to the beginning as
>page 680 of the OS/2 Reference Vol.1 says to do, I go from getting a return
>value of "0" to a return value of "3" which indicates a bad filename. (I
>think)
>Summary:
>
>"/pipe/dfa/config.dfa" returns 0 and works correctly.
>"/wimmer/pipe/config.dfa" returns 3 and doesn't work.
>"//wimmer/pipe/config.dfa" returns 3 and doesn't work.
The server program must always create the named pipe simply starting with
"/pipe/..." or for DOS and OS/2 more correct "\pipe\..." (as explained in the
MS OS/2 Programmer's reference).
The client program specifies the name of the pipe it wants to connect in the
open call. Now if the program runs on the same machine it simply opens
"\pipe\config.dfa", BUT if the program runs on a different machine, it
must also supply the machine name of the server: "\\wimmer\pipe\config.dfa".
In your case the with LanManager 2.0 running a peer server it might also work
that the client specifies the full name.
So keep in mind: 1. The server always creates "\pipe\dfa\config.dfa"
2. The client opens the pipe with either the above name or
with the server name in front.
By the way: There is a typo in the MS OS/2 Programmer's Reference Vol. 1
on page 680. The form for the remote pipe name is wrong, it should read:
\\server\pipe\name
Also keep in mind, that in C the character '\' is the escape character within
strings. So a call to would look like:
DosMakeNmPipe("\\pipe\\name",....);
The client would call, for example:
retval = DosOpen("\\\\wimmer\\pipe\\name",....);
I hope this helps.
Peter Michalica
HP Vienna
Technical Details
Message-ID:
<2307@hpuviea.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!mcsun!tuvie!hpuviea!peterReferences:
<1991Feb04.070011.7873@eecs.wsu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!mcsun!tuvie!hpuviea!peter From: peter@hpuviea.UUCP (Peter Michalica) Newsgroups: comp.os.os2.programmer Subject: Re: Programming with named pipes, again Keywords: named pipes,LanManager Message-ID: <2307@hpuviea.UUCP> Date: 11 Feb 91 18:15:12 GMT References: <1991Feb04.070011.7873@eecs.wsu.edu> Reply-To: peter@hpuviea.UUCP (Peter Michalica) Organization: Hewlett-Packard, Vienna Lines: 47