static NamedPipeServerStream CreateServerStream()
{
var user = WindowsIdentity.GetCurrent().User;
var security = new PipeSecurity();
security.AddAccessRule( new PipeAccessRule( user, PipeAccessRights.FullControl, AccessControlType.Allow ) );
security.SetOwner( user );
security.SetGroup( user );
IncrementServers();
try
{
return new NamedPipeServerStream(
ProtocolConstants.PipeName,
PipeDirection.InOut,
20,
PipeTransmissionMode.Byte,
PipeOptions.Asynchronous,
CommandLineLength,
CommandLineLength,
security );
}
catch ( Exception )
{
DecrementServers();
throw;
}
}