Files
laatzen/Common/NamedPipes/NamedPipeClient.cs
T
2023-11-09 08:59:09 +01:00

29 lines
703 B
C#

using System.ComponentModel;
using System.IO.Pipes;
namespace NamedPipes
{
public class NamedPipeClient : NamedPipe
{
protected override void Run(object sender, DoWorkEventArgs args)
{
try
{
var pipe = new NamedPipeClientStream(
serverName: ".",
pipeName: PIPE_NAME,
direction: PipeDirection.InOut,
options: PipeOptions.Asynchronous);
this.pipe = pipe;
pipe.Connect();
base.Run(sender, args);
}
catch
{
base.Disconnect();
}
}
}
}