CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 1999
    Location
    Austria
    Posts
    53

    Problems with Pipes

    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


  2. #2
    Join Date
    Oct 1999
    Location
    Shenzhen, P.R.China
    Posts
    35

    Re: Problems with Pipes

    I can't answer your question. I have a question to ask you. Can we use a named pipe in VB? how?
    Thanks.


  3. #3
    Join Date
    May 1999
    Location
    Omika, Japan
    Posts
    729

    Re: Problems with Pipes

    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

  4. #4
    Join Date
    Nov 1999
    Location
    Austria
    Posts
    53

    Re: Problems with Pipes

    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured