libt2n: (gerd) add lots of error handling code, unit tests for this error handling...
[libt2n] / examples-codegen / example1-client / client.cpp
index e35799e..d0a5ebe 100644 (file)
@@ -6,24 +6,26 @@
 
 int main(int argc, char** argv)
 {
-  // use a local socket (a.k.a "unix domain socket")
-  // if you want to connect to a tcp/ip server you pass the port and server name to the constructor
-  libt2n::socket_client_connection sc("./socket");
-  // this generated class has a method for each of our exported procedures
-  cmd_group_t2nexample_client cc(sc);
+    // use a local socket (a.k.a "unix domain socket")
+    // if you want to connect to a tcp/ip server you pass the port and server name to the constructor
+    libt2n::socket_client_connection sc("./socket");
+    // this generated class has a method for each of our exported procedures
+    cmd_group_t2nexample_client cc(sc);
 
-  bool throwok=false;
+    bool throwok=false;
 
-  // exceptions are passed back to the client transparently
-  try
-  {
-    // call the remote procedure (we pass "throw" to cause a exception to be thrown)
-    cc.testfunc("throw");
-  }catch(libt2n::t2n_runtime_error &e){
-    throwok=(std::string(e.what())=="throw me around");
-  }
+    // exceptions are passed back to the client transparently
+    try
+    {
+        // call the remote procedure (we pass "throw" to cause a exception to be thrown)
+        cc.testfunc("throw");
+    }
+    catch(libt2n::t2n_runtime_error &e)
+    {
+        throwok=(std::string(e.what())=="throw me around");
+    }
 
-  // call remote procedure and check the return value is correct
-  return ( throwok && ( cc.testfunc("hello") == "hello, testfunc() was here" ) )
-    ? EXIT_SUCCESS : EXIT_FAILURE;
+    // call remote procedure and check the return value is correct
+    return ( throwok && ( cc.testfunc("hello") == "hello, testfunc() was here" ) )
+        ? EXIT_SUCCESS : EXIT_FAILURE;
 }