public static GrpcClient Create(IPEndPoint port) { if (_client != null) { return(_client); } _grpcChannel = new Channel($"{port.Address}:{port.Port}", ChannelCredentials.Insecure); _client = new GrpcClient(_grpcChannel); return(_client); }
static async void StartGrpcProcess() { _client = Grpc.GrpcClient.Create(new IPEndPoint(IPAddress.Loopback, 9999)); Console.WriteLine("启动连接...."); try { await _client.StartConnectAsync(); } catch { Console.WriteLine("连接异常........."); } }