Exemple #1
0
        static async Task Main(string[] args)
        {
            const string host = "localhost";
            const int    port = 50000;

            var channel = new Channel($"{host}:{port}", ChannelCredentials.Insecure);
            var client  = new DemoService.DemoServiceClient(channel);

            Console.WriteLine("Client has started...");

            while (true)
            {
                Console.ReadKey();
                await client.SendAsync(new Message
                {
                    Id          = Guid.NewGuid().ToString("N"),
                    User        = "******",
                    Content     = "hello",
                    Attachments =
                    {
                        new Attachment
                        {
                            Name = "Attachment #1"
                        }
                    }
                });

                Console.WriteLine("Message sent");
            }
        }
        public static void Main()
        {
            WriteLine("client - wait for services");
            ReadLine();
            DemoService.DemoServiceClient service = new DemoService.DemoServiceClient();

            WriteLine(service.GetData("HelloB"));
            ReadLine();
        }
Exemple #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Demo Client is Ready...");
            var host = "127.0.0.1";
            var port = "9999";

            var channel       = new Channel($"{host}:{port}", ChannelCredentials.Insecure);
            var serviceClient = new DemoService.DemoServiceClient(channel);

            var result1 = serviceClient.TestWithEmpty(new EmptyMsg());

            Console.WriteLine($"Calling Say and return response is {result1.Values}");

            Console.WriteLine("Please type input for calling Say:");
            var msg     = Console.ReadLine();
            var result2 = serviceClient.Say(new GreetingMsg {
                Value = msg
            });

            Console.WriteLine($"Calling Say and return response is {result2.MsgValue},{result2.ReturnValue}");
        }
Exemple #4
0
 public DemoClient(DemoService.DemoServiceClient client)
 => this.client = client ?? throw new ArgumentNullException(nameof(client));