summaryrefslogtreecommitdiffstats
path: root/frtstream/src/example/simple.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'frtstream/src/example/simple.cpp')
-rw-r--r--frtstream/src/example/simple.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/frtstream/src/example/simple.cpp b/frtstream/src/example/simple.cpp
new file mode 100644
index 00000000000..000a9edbc8f
--- /dev/null
+++ b/frtstream/src/example/simple.cpp
@@ -0,0 +1,45 @@
+// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+#include <vespa/fastos/fastos.h>
+#include <iostream>
+#include <csignal>
+#include <vector>
+#include <string>
+#include <set>
+
+#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);
+
+
+}