Solved

CreateNamedPipe... someone got any idea?

Posted on 1998-05-25
11
686 Views
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?
0
Comment
Question by:Nitemare
11 Comments
 
LVL 3

Expert Comment

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

Norbert
0
 

Author Comment

by:Nitemare
Comment Utility
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.
0
 

Author Comment

by:Nitemare
Comment Utility
Character after dot is a mistake. Ignore it.
0
 
LVL 22

Expert Comment

by:nietod
Comment Utility
Have you tried using GetLastError() to see what the error is?  You should always try that first.
0
 
LVL 22

Expert Comment

by:nietod
Comment Utility
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.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 22

Expert Comment

by:nietod
Comment Utility
Woops.  Got posted to the wrong question!  sorry.
0
 
LVL 5

Expert Comment

by:laeuchli
Comment Utility
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?
0
 

Author Comment

by:Nitemare
Comment Utility
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!!!
0
 
LVL 1

Expert Comment

by:rcabanie
Comment Utility
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...
0
 
LVL 2

Accepted Solution

by:
abesoft earned 200 total points
Comment Utility
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:
   \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\NullSessionPipes

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:

   \\hardknox\pipe\mypipe

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

Hope this helps!
0
 

Author Comment

by:Nitemare
Comment Utility
Bingo!!!

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.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

762 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now