// 实现SayHello方法 public override Task <HelloReply> SayHello(HelloRequest request, ServerCallContext context) { return(Task.FromResult(new HelloReply { Message = "Hello " + request.Name })); }
public override Task <HelloReply> SayHello(HelloRequest request, ServerCallContext context) { return(Task.FromResult(new HelloReply { Message = $"Hello {request.Name}! The time on this server is { DateTime.Now}" })); }
public override async Task SayHelloAgain(HelloRequest request, IServerStreamWriter <HelloReply> responseStream, ServerCallContext context) { await responseStream.WriteAsync(new HelloReply { Message = "Hello " + request.Name }); }
// Server side handler of the SayHello RPC public override async Task <HelloReply> SayHello(HelloRequest request, ServerCallContext context) { return(new HelloReply { Message = "Hello " + request.Name }); }