Ejemplo n.º 1
0
        public static async Task GetNodeByIdAsync(NodeServiceClient client)
        {
            var res = await client.GetNodeByIdAsync(new GetNodeByIdRequest()
            {
                Id = 1
            });

            Console.WriteLine(res.Node);
        }
Ejemplo n.º 2
0
 private static async Task getAllAsync(NodeServiceClient client)
 {
     using (var call = client.GetAll(new Messages.GetAllRequest()))
     {
         var responseStream = call.ResponseStream;
         while (await responseStream.MoveNext())
         {
             Console.WriteLine(responseStream.Current.Node);
         }
     }
 }
Ejemplo n.º 3
0
        private static async Task sendMetaDataAsync(NodeServiceClient client)
        {
            Metadata md = new Metadata();

            md.Add("username", "moe");
            md.Add("password", "pass");

            try
            {
                await client.GetNodeByIdAsync(new GetNodeByIdRequest(), md);
            }
            catch (Exception ex)
            {
                Console.WriteLine("exception " + ex);
            }
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            //var option = int.Parse(args[0]);
            const int port = 9000;

            var            cacert  = File.ReadAllText(@"ca.crt");
            var            cert    = File.ReadAllText(@"client.crt");
            var            key     = File.ReadAllText(@"client.key");
            var            keypair = new KeyCertificatePair(cert, key);
            SslCredentials creds   = new SslCredentials(cacert, keypair);
            var            channel = new Channel("DESKTOP-H7CAL1I", port, creds);
            var            client  = new NodeServiceClient(channel);

            //sendMetaDataAsync(client).Wait();
            getAllAsync(client).Wait();
            //GetNodeByIdAsync(client).Wait();
            Console.WriteLine("Press any key to exist");
            Console.ReadKey();
        }
Ejemplo n.º 5
0
 public Client(string uri)
 {
     this.service = CreateConnection(uri);
     Initialize();
 }