summaryrefslogtreecommitdiffstats
path: root/frtstream/src/example/simple.cpp
blob: 5d4a5d067c77890a91ee8c01bcc9c57cb067dec3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/fastos/app.h>

#include <vespa/frtstream/frtclientstream.h>

using namespace std;
using frtstream::FrtClientStream;
using frtstream::Method;
using frtstream::InvokationException;

const string connectionSpec = "tcp/test-tonyv:9997";

class TestApp : public FastOS_Application {
public:
    int Main() {
      FrtClientStream s(connectionSpec);

      try {
          s <<Method("add") <<1 <<2;

          int res;
          s >> res;

          cout <<"Result = " <<res <<endl;
      } catch(const InvokationException& e) {
          cerr <<e <<endl;
      }
      return 0;

    }
};


int main(int argc, char** argv) {
    TestApp app;
    return app.Entry(argc, argv);


}