private static RpcService.RpcServiceClient CreateRpcClient(Channel channel) { Log.Information($"Create Rpc client..."); var client = new RpcService.RpcServiceClient(channel); return(client); }
public void Connect() { try { if (_connected) { return; } _channel = new Channel(IpRpcServer, ChannelCredentials.Insecure); _rpcClient = new RpcService.RpcServiceClient(_channel); do { try { var res = _rpcClient.TestConnection(new TestRequest()); _connected = true; return; } catch (Exception ex) { if (ex.Message.Contains("StatusCode=Unavailable")) { Thread.Sleep(TimeSleep); //wait for new connection } else { throw new Exception(ex.Message); } } } while (!_connected); } catch (Exception ex) { } }
public void Run() { if (channel == null || client == null) { // 서버 연결 string liveHost = "183.99.10.187:20051"; string inhouseHost = "127.0.0.1:20051"; channel = new Grpc.Core.Channel(inhouseHost, Grpc.Core.ChannelCredentials.Insecure); client = new RpcService.RpcServiceClient(channel); } }
private RpcClient(RpcService.RpcServiceClient client) { _client = client; }