[comp.os.os2.misc] Help with Named Pipes error messages

seg@ingres.com (scott e garfinkle) (01/24/91)

Newsgroups: comp.os.os2.programmer
Subject: Re: Help with Named Pipes error messages
Summary: 
Expires: 
References: <1991Jan22.110653.3328@eecs.wsu.edu>
Sender: 
Followup-To: 
Distribution: 
Organization: Ask Computer Systems, Ingres Products Div.
Keywords: 

In article <1991Jan22.110653.3328@eecs.wsu.edu> wbonner@eecs.wsu.edu (Wim Bonner) writes:
>
>I am trying to program using  Presentation Manager and Named pipes.   My
>server program creates a pipe, then waits till the client opens it, then
>sends some messages which  the client reads and  replies to.  They  then
>agree on  the name  for a  permanent pipe  between them,  and the client
>opens the second pipe (which  the server had already created)  This does
>not get a  return value of  0, but does  get the same  return value that
>opening the first pipe  got, and it passed  the correct messages, so  it
>seemed that it should be  ok.  The problem appears  to be when I try  to
>set the named pipe state in the  second named pipe.  The call is  almost
>exactly the same, but I get a 1 for a return value, which does not  seem
>to correspond with anything useful in BSEERR.H.

1 is ERROR_INVALID_FUNCTION -- "the pmode argument tried to change
a pipe-mode parameter other than the blocking state or the read mode, or
there was an attempt to put a byte-stream pipe into message-read mode".

Are you sure that the server .exe corresponds to the source?  At first
blow, it sounds to me like the second pipe doesn't have NP_TYPE_MESSAGE
set, though it dows seem so from your source.

Anyway, why bother to open a second pipe at all?  Why not just keep the
connection you started with, spawn off a thread to deal with that connection,
and go make another instance of the named pipe? 

	-scott garfinkle

wbonner@eecs.wsu.edu (Wim Bonner) (01/25/91)

In article <1991Jan23.172128.26448@ingres.Ingres.COM> seg@ingres.com (scott e garfinkle) writes:
>Are you sure that the server .exe corresponds to the source?  At first
>blow, it sounds to me like the second pipe doesn't have NP_TYPE_MESSAGE
>set, though it dows seem so from your source.
>
>Anyway, why bother to open a second pipe at all?  Why not just keep the
>connection you started with, spawn off a thread to deal with that connection,
>and go make another instance of the named pipe? 

I am writing the program so that there will be multiple clients who want to
talk with the one server.  I am having seperate pipes for each client, but
am having them open a "config" pipe first, and following that, figure out what
pipe they should open permanently.

Anyway, I figured out what my problem was.  

I was actually getting a "PIPE BUSY" message.  The way I was figuring out what
messages I was getting was to use printf statements.  Unfortunately, I was 
printing the pipe name and the open error code using the same printf statement, 
and because the pipe name was pointed to using a PSZ (32 bit pointer) printf
was using the offset correctly and printing the name, but then was using the 
segment to print the error code, instead of the error code.

Now I have taken care of the problem, and hopefully will get the logic of 
the message passing taken care of within the next few days.

Wim.
-- 
|  wbonner@yoda.eecs.wsu.edu  |
| 27313853@wsuvm1.csc.wsu.edu |
|   27313853@Wsuvm1.BITNET    |
|  72561.3135@CompuServe.com  |