views:

367

answers:

2

I remember using Named Pipes for communicating between 2 machines (back in Windows NT). How come now I read that Named Pipes are only for Inter Process Communication in the SAME machine? (in Vista and Windows 7)

A: 

Because if they were non-local they'd be called Sockets.

EDIT: actually, that is a rather a flippant, UNIX-centric answer. On UNIX, a named pipe is for local communication only. By contrast, sockets can be used for both local and non-local communication, and can use a variety of transport protocols. Another difference is in the way that you find them. Named pipes are typically found in the filesystem namespace. Sockets (or more precisely, the socket end points) are identified by a network address of some kind which is typically looked up in some kind of name server / service.

Stephen C
Not sure I agree (or understand you). Pipes add a lot of handshacking on top of sockets. They are not the same.
Nestor
Oh, these *nix gurus! :-)
marc_s
@Nestor - I agree. But my point remains valid I think. For non-local communication it is a good idea to use a Socket. Especially if there is a possibility that you might want the remote machine to be non-Windows ... sometime in the future.
Stephen C
ahaaaa... so WCF took from Unix? May be...
Nestor
"Those who don't understand UNIX are condemned to reinvent it, poorly." – Henry Spencer
Stephen C
@Stephen: yes, absolutely - I guess that's why WCF implements named pipes only for same-machine communication, and uses NetTcp (i.e. sockets) for between-machines - they followed your recommendation :-)
marc_s
+4  A: 

Named pipes as an OS infrastructure are totally available for between-machine communication - see the MSDN docs on Named Pipes.

Named pipes can be used to provide communication between processes on the same computer or between processes on different computers across a network. If the server service is running, all named pipes are accessible remotely. If you intend to use a named pipe locally only, deny access to NT AUTHORITY\NETWORK or switch to local RPC.

However, I assume you might be talking about the WCF binding "NetNamedPipe" which indeed is on-same-machine-only communication. Why that's the case is something you'd have to ask the WCF design team - I don't have any information on that.

But as Stephen C rightfully says - if you need machine-to-machine communication (in WCF), use the netTcpBinding instead - the two are fairly similar in their capabilities and their speed and feature set.

See this article on the support added in .NET 3.5 for named pipes.

Marc

marc_s
Also... i think configuring SQL to accept pipes only works locally
Nestor
@Nestor: no, I believe named pipes for SQL server actually go across machines; the "mapped memory" approach is local only.
marc_s
oh... ok. Thanks marc_s
Nestor