Initial commit
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
using PipeMethodCalls;
|
||||
using Server;
|
||||
using Shared;
|
||||
|
||||
string pipeName = args.FirstOrDefault(a => a.StartsWith(PipeConstants.PipeNameArgPrefix))?
|
||||
[PipeConstants.PipeNameArgPrefix.Length..] ?? "PipeDemo";
|
||||
|
||||
Console.WriteLine($"Server started. Pipe: {pipeName}");
|
||||
|
||||
// Exceptions in handler methods are caught by PipeMethodCalls and sent to the client
|
||||
// (client receives PipeInvokeFailedException with the server exception details).
|
||||
var server = new PipeServer<ICalculator>(
|
||||
new JsonFieldsPipeSerializer(),
|
||||
pipeName,
|
||||
() => new Calculator());
|
||||
|
||||
await server.WaitForConnectionAsync();
|
||||
Console.WriteLine("Client connected.");
|
||||
|
||||
await server.WaitForRemotePipeCloseAsync();
|
||||
Console.WriteLine("Client disconnected. Server exiting.");
|
||||
Reference in New Issue
Block a user