3 ms·
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 cou
by thrower123 5y ago
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 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.
- jborean93 5y agoCan 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.
- thrower123 5y agoIt 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/namedpipeserverstream-receive-max-1024-bytes-why https://stackoverflow.com/questions/31936100/namedpipeserver...
- jborean93 5y agoThanks 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.