I am using .NET Core 3.1 and want to create a GRPC Service with a Console App as the Server and a WPF App as the Client.
I can't see any examples online - for some reason all the Console Apps seem to connect and send messages, none are Servers.
Is it possible to have a Console App starting the Service and a WPF App connecting and sending a message to it?
I have downloaded below project and am trying to see if I can get a Console App to be the Server. [GRPC in .NET Core][1]
Any pointers appreciated. [1]: https://www.jenx.si/2019/06/14/experimenting-with-grpc-in-net-core/
The Console App below is now the Server but I am not able to read and store the Payload from the Client in the Main function - I can see it is received in from the Client.
How can I store the payload message from the client in the Main function?
//Console App Main function listening for
static async Task Main(string[] args)
{
_gRpcServer = new Server
{
Services ={Jenx.Grpc.SimpleDemo.Contracts.JenxSimpleGrpcService.BindService(new ConsoleAppGrpcClient())},
Ports = {new ServerPort("localhost", 505050, ServerCredentials.Insecure)}
};
}
//receives Client Message successfully
public override Task<ReplyMessage> SendMessage(RequestMessage request, ServerCallContext context)
{
Console.WriteLine($"Message Received: {request.RequestPayload}");
Console.WriteLine("Sending message back to the client...");
//<<---need to Store below in variable and return to Main function above--->>
return Task.FromResult(new ReplyMessage { ResponsePayload = $"ServerSideTime is {DateTime.Now}" });
}