]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/thrift/lib/csharp/test/Multiplex/Client/Multiplex.Test.Client.cs
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / jaegertracing / thrift / lib / csharp / test / Multiplex / Client / Multiplex.Test.Client.cs
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20 using System;
21 using System.Collections.Generic;
22 using Thrift.Collections;
23 using Thrift.Transport;
24 using Thrift.Protocol;
25 using Thrift.Server;
26 using Thrift;
27 using Test.Multiplex;
28
29 namespace Test.Multiplex.Client
30 {
31 public class TestClient
32 {
33 static void Execute(int port)
34 {
35 try
36 {
37 TTransport trans;
38 trans = new TSocket("localhost", port);
39 trans = new TFramedTransport(trans);
40 trans.Open();
41
42 TProtocol Protocol = new TBinaryProtocol(trans, true, true);
43
44 TMultiplexedProtocol multiplex;
45
46 multiplex = new TMultiplexedProtocol(Protocol, Constants.NAME_BENCHMARKSERVICE);
47 BenchmarkService.Iface bench = new BenchmarkService.Client(multiplex);
48
49 multiplex = new TMultiplexedProtocol(Protocol, Constants.NAME_AGGR);
50 Aggr.Iface aggr = new Aggr.Client(multiplex);
51
52 for (sbyte i = 1; 10 >= i; ++i)
53 {
54 aggr.addValue(bench.fibonacci(i));
55 }
56
57 foreach (int k in aggr.getValues())
58 {
59 Console.Write(k.ToString() + " ");
60 Console.WriteLine("");
61 }
62 trans.Close();
63 }
64 catch (Exception e)
65 {
66 Console.WriteLine(e.Message);
67 }
68 }
69
70 static void Main(string[] args)
71 {
72 int port = 9090;
73 if (args.Length > 0)
74 {
75 port = ushort.Parse(args[0]);
76 }
77 Execute(port);
78 Console.WriteLine("done.");
79 }
80 }
81 }
82