Sending data through NamedPipe when the server shuts down

I was wondering how to deal with a situation where you have successfully connected two processes through a named pipe (one server and one client) and suddenly (for some reason) the server process terminates.

What happens to the pipe? Is he closing? What happens to the information sent by the client to the server? Is mistaken? How can a client know that the server is down?

All the best,

Gilles

+3
source share
1 answer

If you use, for example, System.IO.Pipesand NamedPipeServerStream, you will get an IOException when the pipe breaks or disconnects.

NamedPipeClientStream , , , NamedPipeClientStream.Connect() NamedPipeClientStream.Connect(Int32) - , , StreamReader.ReadLine() IOException, - .

NamedPipeClientStream.IsConnected , , .

+1

Source: https://habr.com/ru/post/1777602/


All Articles