Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

CreateNamedPipe... someone got any idea?

Posted on 1998-05-25
Last Modified: 2008-02-01
Lately I have been experimenting with pipes. I made two apps (server and client) respectively. The problem is that the server app doesn't initialize the pipe. I checked for all the parameters and also reffered to the example on a CD (Visual C++ 4.0 Developer Studio) yet no success. The CreateNamedPipe function doesnt create any pipes.

The pipe name string is written correctly \\\\.¡\\pipe\\mypipe for the server side.
I checked server app even on the same computer as client one  (basically it was meant to run on a server - NT 4.0), otherwise the network itself isn't a problem.

I'm asking what else could be wrong?
Question by:Nitemare

Expert Comment

ID: 1164693
Hi The OnlineDocumentation says the path to the pipe has to be
\\.\pipe\pipename (for using a constant within C/C++
if it is not a typo you have
and that is wrong as the docs says
Hope that helps


Author Comment

ID: 1164694
Yes that's what documentation said. But one should be aware that specifying special character in a string you must use \ and then the character you want in your string. Therefore \\ in a string means \. This was also my first mistake. I debugged the app and saw the string I want is in memory just as it should be. there has to be seomething else.

Author Comment

ID: 1164695
Character after dot is a mistake. Ignore it.
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

LVL 22

Expert Comment

ID: 1164696
Have you tried using GetLastError() to see what the error is?  You should always try that first.
LVL 22

Expert Comment

ID: 1164697
To use VC's memory debugging features you use the procedure _CrtSetDbgFlg().  with the _CRTDBG_LEAK_CHECK_DF flag.  (Or this flag in with the existing flags.  This will report memory block overruns and blocks that weren't deleted when the program terminates.  To make it really effective, though you need to overload the new operator so that it stores with each block the source code file name and line number from which thr block was allocated.  Then when you gets these errors reported, you can doubleclick the error message and it will show you the line of code that allocated the block.  This is all documented in the VC help.
LVL 22

Expert Comment

ID: 1164698
Woops.  Got posted to the wrong question!  sorry.

Expert Comment

ID: 1164699
Feel free to reject this because it is a shot in the dark, but named pipes can only be created on NT. Is your test machine an NT?

Author Comment

ID: 1164700
Yes. I use NT 4.0 Server. That's the whole  point. Since it didn't work I ran both apps on Windows 95 machine because I suspected something could be wrong with network implementation.
NT machine is just as is, no SP3 or alike have been installed.
I read all docs I could find on that topic and haven't found a statement that would imply named or annonymous pipes won't work on Windows 95.

Perhaps someone could pass an alternative?

Promising solution will get double points!!!

Expert Comment

ID: 1164701
On Win95, only the client side of named pipes is implemented. So your client app should work on win95 and on NT, not your server.

What exactly is your problem? Does "CreateNamedPipe" return an invalid handle? If not, does connectnamedpipe return you an instance or is your client just failing?

Is your server app a service?

I have a working program with named pipes for a server and programs from NT and 95 can connect to it...

Accepted Solution

abesoft earned 200 total points
ID: 1164702
Your problem could be coming from the fact that the client is connecting as a NULL session.  (It's hard to tell from your question if this is the case or not.)

To allow a NULL session to connect to a pipe, check out MS-Knowledge base article Q126645.  Along with a lot of other things, it says:

>You can allow access to a named pipe using the Null Session by adding the pipe name to the following registry entry on the machine that creates the named pipe:

The pipe name added to this entry is the name after the last backslash in the string used to open the pipe. For example, if you use the following string to open the pipe:


you would add mypipe to the NullSessionPipes entry on the computer named hardknox.

Hope this helps!

Author Comment

ID: 1164703

Yes I appologize that I didn't supply as much data as needed but you gave me an extra edge with that article. It solved a few other things too. Thx abesoft.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Lambda for random numbers problem 7 116
TCP/IP Socket - connection close results in data lost 14 140
c++ syntax question 9 52
What is sub-make ? 2 71
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question