blob: ccfe21df1f7ed19230e01e5af75d660b2cda92c0 [file] [log] [blame]
Jens Geyer72034242013-05-08 18:46:57 +02001/*
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
20using System;
21using System.Collections.Generic;
22using Thrift.Collections;
23using Thrift.Transport;
24using Thrift.Protocol;
25using Thrift.Server;
26using Thrift;
27using Test.Multiplex;
28
29
30namespace Test.Multiplex.Client
31{
Jens Geyerd5436f52014-10-03 19:50:38 +020032 public class TestClient
33 {
Jens Geyer72034242013-05-08 18:46:57 +020034 private void Run()
35 {
36 try
37 {
38 TTransport trans;
39 trans = new TSocket("localhost", 9090);
40 trans = new TFramedTransport(trans);
41 trans.Open();
42
43 TProtocol Protocol = new TBinaryProtocol(trans, true, true);
44
45 TMultiplexedProtocol multiplex;
46
47 multiplex = new TMultiplexedProtocol( Protocol, Constants.NAME_BENCHMARKSERVICE);
48 BenchmarkService.Iface bench = new BenchmarkService.Client( multiplex);
49
50 multiplex = new TMultiplexedProtocol( Protocol, Constants.NAME_AGGR);
51 Aggr.Iface aggr = new Aggr.Client( multiplex);
Jens Geyerd5436f52014-10-03 19:50:38 +020052
Jens Geyer72034242013-05-08 18:46:57 +020053 sbyte i;
54 for( i = 1; 10 >= i; ++i)
55 {
56 aggr.addValue( bench.fibonacci(i));
57 }
58
59 foreach( int k in aggr.getValues())
60 {
61 Console.Write(k.ToString()+" ");
62 Console.WriteLine("");
63 }
64 }
65 catch( Exception e)
66 {
67 Console.WriteLine( e.Message);
68 }
69 }
70
71
72 public static void Execute()
73 {
74 TestClient client = new TestClient();
75 client.Run();
76 }
77
78 static void Main(string[] args)
79 {
80 Execute();
81 Console.WriteLine("done.");
82 Console.ReadLine();
83 }
84
85 }
86}
87