Skip to content

Comment on Named Pipes in .NET 6 with Tray Icon and Service

Comments

Named pipes have been in Windows for many years https://docs.microsoft.com/en-us/windows/win32/api/winbase/n...

Been using them since 1992 but at this point I would naturally turn to sockets, even on the same machine. I can't even really say why though. Named pipes are nice because they are really more like a file but at this point sockets feel more natural because they exist and are supported everywhere.

You can apply permissions to named pipes and, well, they're named which is useful since you can use a unique and deterministic enough name that you don't need an extra band of communication for the client to know what port the server ended up starting on.

Yeah, good point, as opposed to anonymous pipes, which also still exist.

TCP server cannot assume the security context of the client, thus privilege elevation attack can easily happen.

More importantly in a lot of cases, you can ask the kernel for the client's SID as the server, and make decisions knowing that the client couldn't forge it.

First thing I do with SQL Server setups - turn off named pipes :)

Is there a reason you do this? Curious, I havent had to setup SQL Server myself in a while so I don't know what a reasonable reason would be.

Named pipes are fast when the database is on the same box, but slower than a normal tcp connection when the database is remote. Something to do with PeekNamedPipe calls having to prepend reads.

Yeah one of my favorite SE posters talks a little more about it, generally the benefits are only there if you have app/db/sql server all on the same box.

https://dba.stackexchange.com/a/24176/15642

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.