Renamed IServerMethods to `IPipeServerMethods
This commit is contained in:
@@ -14,7 +14,7 @@ Log("Client started.");
|
|||||||
string pipeName = $"PipeDemo-{Environment.ProcessId}-{Guid.NewGuid():N}";
|
string pipeName = $"PipeDemo-{Environment.ProcessId}-{Guid.NewGuid():N}";
|
||||||
|
|
||||||
Process? serverProcess = null;
|
Process? serverProcess = null;
|
||||||
PipeClient<IServerMethods> client = null!;
|
PipeClient<IPipeServerMethods> client = null!;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -161,7 +161,7 @@ async Task StartServerAndConnectAsync(string pipeName)
|
|||||||
};
|
};
|
||||||
serverProcess = process;
|
serverProcess = process;
|
||||||
|
|
||||||
client = new PipeClient<IServerMethods>(new JsonFieldsPipeSerializer(), pipeName);
|
client = new PipeClient<IPipeServerMethods>(new JsonFieldsPipeSerializer(), pipeName);
|
||||||
using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
|
using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
|
||||||
await client.ConnectAsync(cts.Token);
|
await client.ConnectAsync(cts.Token);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ Console.WriteLine($"Server started. Pipe: {pipeName}");
|
|||||||
|
|
||||||
// Exceptions in handler methods are caught by PipeMethodCalls and sent to the client
|
// Exceptions in handler methods are caught by PipeMethodCalls and sent to the client
|
||||||
// (client receives PipeInvokeFailedException with the server exception details).
|
// (client receives PipeInvokeFailedException with the server exception details).
|
||||||
var server = new PipeServer<IServerMethods>(
|
var server = new PipeServer<IPipeServerMethods>(
|
||||||
new JsonFieldsPipeSerializer(),
|
new JsonFieldsPipeSerializer(),
|
||||||
pipeName,
|
pipeName,
|
||||||
() => new ServerMethods());
|
() => new ServerMethods());
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using System.Numerics;
|
|||||||
|
|
||||||
namespace Server;
|
namespace Server;
|
||||||
|
|
||||||
public class ServerMethods : IServerMethods
|
public class ServerMethods : IPipeServerMethods
|
||||||
{
|
{
|
||||||
public int Add(int a, int b) => a + b;
|
public int Add(int a, int b) => a + b;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ using System.Numerics;
|
|||||||
|
|
||||||
namespace PipeShared;
|
namespace PipeShared;
|
||||||
|
|
||||||
public interface IServerMethods
|
public interface IPipeServerMethods
|
||||||
{
|
{
|
||||||
int Add(int a, int b);
|
int Add(int a, int b);
|
||||||
Vector3 AddVector(Vector3 a, Vector3 b);
|
Vector3 AddVector(Vector3 a, Vector3 b);
|
||||||
Reference in New Issue
Block a user