static async Task Main() { AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); var channel = GrpcChannel.ForAddress("http://localhost:10042"); var calc = new Calculator.CalculatorClient(channel); for (int i = 0; i < 5; i++) { using var ma = calc.MultiplyAsync(new MultiplyRequest { X = i, Y = i }); var calcResult = await ma.ResponseAsync; Console.WriteLine(calcResult.Result); } var clock = new TimeService.TimeServiceClient(channel); using var subResult = clock.Subscribe(new Empty()); var reader = subResult.ResponseStream; while (await reader.MoveNext(default))
static async Task Main() { var channel = new Channel("localhost", 10042, ChannelCredentials.Insecure); try { var calc = new Calculator.CalculatorClient(channel); for (int i = 0; i < 5; i++) { using var ma = calc.MultiplyAsync(new MultiplyRequest { X = i, Y = i }); var calcResult = await ma.ResponseAsync; Console.WriteLine(calcResult.Result); } var clock = new TimeService.TimeServiceClient(channel); using var subResult = clock.Subscribe(new Empty()); using var reader = subResult.ResponseStream; while (await reader.MoveNext(default))