Click to See Complete Forum and Search --> : Problems with Pipes


pueromane
December 8th, 1999, 07:34 AM
I have written two programs. One Server and one client witch run on the same computer. I want to make the comunication with pipes.

The Server creates the Pipe with the "CreateNamedPipe" command and the client connects to the server with the "CreateFile" command. I use the "ReadFile" and "WriteFile" to read and write to the pipe.

My Problem is that when the client wants to connect to the pipe with the Createfile command in the debug mode it works fine, but when the program runs in the non debug mode the createfile command returns -1. When I make a delay before each Createfile it works, but the delay is about one second, and that makes the application very slow.

Does anyone has a sample program how I can make it other, or can help me with that problem.

mfG Pueromane

Andrew Luit
December 8th, 1999, 07:58 PM
I can't answer your question. I have a question to ask you. Can we use a named pipe in VB? how?
Thanks.

Ravi Kiran
December 9th, 1999, 04:12 AM
I dont know if it works.. just an idea.
Try some synchronisation between the client and server. Like an Event or something.
Logic could be something like:
Server Creates Event. Then goes on to create the pipe, and after that he will signal the event. Client waits for this event to be signalled, before creating a connection to the pipe with CreateFile. Client could be checking for the event to get signalled in a loop with not too long time interval, and this way it even gives you a change to abort after few tries, if you care.

RK

pueromane
December 9th, 1999, 08:15 AM
Yes you can.

In the MSDN is a full example for a server and a client application.
I don't know the site but search for CreateNamedpipe or ConnectNamedPipe(?)
I have the code from the MSDN too, and have changed it like I need it.

If you have the same problem please tell me.

mfG Pueromane