Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think this is the first NamedPipes tutorial in C# that I've ever seen that doesn't do things completely wrong by using a StreamWriter or StreamReader. Of course, that's because it uses another library that wraps all the tricky bits of NamedPipes that everybody always does wrong -> https://github.com/HavenDV/H.Pipes

NamedPipes are sweet for doing same-machine IPC on Windows, that is for sure, but the built-in API is full of footguns.



Can you elaborate what’s wrong with using StreamReader or StreamWriter with a np? I’ve used them before so wondering what I’m potentially doing wrong here and what’s the alternative.


It becomes an issue if the data you're reading or writing is larger than 1024 bytes and you are in PipeTransmissionMode.Message, because of some implementation details with buffers and how StreamReader/Writer handle Read/Write calls on the underlying NamedPipe(Client/Server)Stream

See https://stackoverflow.com/questions/31936100/namedpipeserver...


Thanks for the info, I personally avoid the message mode and just operate on bytes so that could be why I haven't had problems with it.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: