Add PipeSecurity option to NamedPipeServerStream constructor in .net core 3.1

305 Views Asked by At

I am trying to establish a full duplex bidirectional communication between namedpipestream client and server, in .net core 3.1, for that I tried to use a .netframework library

But there is an exception in the server when the client is not available, found out that this is the issue with the constructor not having PipeSecurity option as in .net framework.

The issue with this constructor

var _pipe = new NamedPipeServerStream(
    pipeName, PipeDirection.InOut, 1, PipeTransmissionMode.Byte, 
    PipeOptions.Asynchronous | PipeOptions.WriteThrough, 0, 0, pipeSecurity
);

So I modified the constructor like

var _pipe = new NamedPipeServerStream(
    pipeName, PipeDirection.InOut, 1, PipeTransmissionMode.Byte,
    PipeOptions.Asynchronous | PipeOptions.WriteThrough, 0, 0
);

But this is giving exception when the server has no client connected to it.

thanks in advance

0

There are 0 best solutions below