Replace ICalculator with IServerMethods
Rename the server implementation and update client/server pipes to use the shared server-methods interface. Move PipeConstants alongside it and log “Client started.” during client startup.
This commit is contained in:
+2
-2
@@ -9,10 +9,10 @@ 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>(
|
||||
var server = new PipeServer<IServerMethods>(
|
||||
new JsonFieldsPipeSerializer(),
|
||||
pipeName,
|
||||
() => new Calculator());
|
||||
() => new ServerMethods());
|
||||
|
||||
await server.WaitForConnectionAsync();
|
||||
Console.WriteLine("Client connected.");
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.Collections.Concurrent;
|
||||
using ClientServerShared;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Numerics;
|
||||
using ClientServerShared;
|
||||
|
||||
namespace Server;
|
||||
|
||||
public class Calculator : ICalculator
|
||||
public class ServerMethods : IServerMethods
|
||||
{
|
||||
public int Add(int a, int b) => a + b;
|
||||
|
||||
Reference in New Issue
Block a user