Use a dedicated server per client run with unique pipes, automatic failure recovery and reconnection, and robust resource cleanup. Add cancellation and timeout support to calculator operations, plus demos covering exceptions, cancellation, timeouts, and server crashes.
20 lines
473 B
C#
20 lines
473 B
C#
using System.Numerics;
|
|
|
|
namespace ClientServerShared;
|
|
|
|
public interface ICalculator
|
|
{
|
|
int Add(int a, int b);
|
|
Vector3 AddVector(Vector3 a, Vector3 b);
|
|
double Divide(double a, double b);
|
|
Task<string> EchoAsync(string text);
|
|
Task<int> SlowOperationAsync(int delayMs, Guid operationId);
|
|
void CancelOperation(Guid operationId);
|
|
void Crash(int exitCode);
|
|
}
|
|
|
|
public static class PipeConstants
|
|
{
|
|
public const string PipeNameArgPrefix = "--pipe=";
|
|
}
|