Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a NamedPipe just for the local machine

Status
Not open for further replies.

AbelMorelos

Programmer
Jun 10, 2005
6
MX
Hello C++ guys!

If you had read the previous question, you already now what I'm working or trying to do. Well, I'm using a Named Pipe for inter process communication, and now this Named Pipe is working with no problems. But I have a concern, I need this pipe to be accessed only locally(only with processes in the same machine), I don't want any external process to communicate with my pipe(this is risky for my application).

I was looking in the MSDN documentation, and they mention this:
"If you intend to use a named pipe locally only, deny access to NT AUTHORITY\NETWORK or switch to local RPC."
link->
I don't want to switch to RPC, so maybe I'll have to do the first part... I have a couple of questions:
There is another option to create the Pipe just for local access?
If there is no option, how can you do that thing mentioned in the MSDN documentation?

Just to refresh your mind, a NamedPipe is created like this:
CODE
hPipe = CreateNamedPipe(
lpszPipename, // pipe name
PIPE_ACCESS_DUPLEX, // read/write access
PIPE_TYPE_MESSAGE | // message type pipe
PIPE_READMODE_MESSAGE | // message-read mode
PIPE_WAIT, // blocking mode
PIPE_UNLIMITED_INSTANCES, // max. instances
BUFSIZE, // output buffer size
BUFSIZE, // input buffer size
NMPWAIT_USE_DEFAULT_WAIT, // client time-out
NULL); // default security attribute

By the way, in some place I heard ( chech the NamedPipes section) that if you left the security attribute set to null, then the communication will be only in the local machine, but I'm not sure about this being true(I already executed a test, I tried to connect from a remote machine, and I couldn't send messages to my pipe, but anyway I'm not convinced because there is no concrete documentation about this), what do you say?

Regards
Abel Morelos

(I already had posted this in other forum, but I just found this was the rigth place to start).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top