public async Task OnServerStream(string p_title) { var reader = await AtTestRpc.OnServerStream(p_title); while (await reader.MoveNext()) { Log.Information("客户端读取:" + reader.Val <string>()); } Log.Information("服务端写入结束"); }
public async Task OnDuplexStream(string p_title) { var duplex = await AtTestRpc.OnDuplexStream(p_title); for (int i = 0; i < 50; i++) { var msg = $"{p_title} {i}"; await duplex.RequestWriter.Write(msg); Log.Information("客户端写入:" + msg); if (await duplex.ResponseReader.MoveNext()) { Log.Information("客户端读取:" + duplex.ResponseReader.Val <string>()); } await Task.Delay(1000); } }
public async Task OnClientStream(string p_title = "hello") { var writer = await AtTestRpc.OnClientStream(p_title); int i = 0; while (true) { var msg = $"{p_title} {i++}"; if (!await writer.Write(msg) || i > 50) { break; } Log.Information("客户端写入:" + msg); await Task.Delay(1000); } writer.Complete(); }
public Task <bool> SetString(string p_str) { return(AtTestRpc.SetString(p_str)); }
public Task <string> GetString() { return(AtTestRpc.GetString()); }