X-Git-Url: http://developer.intra2net.com/git/?p=libt2n;a=blobdiff_plain;f=examples-codegen%2Fexample1-client%2Fclient.cpp;h=d0a5ebe6110a5ad1ea92424e87ba85448260f3e2;hp=e35799e39458fab7184ea9ffe0fdb243faa8bfa1;hb=c7857475c8b0f02cac3ce29a617a4d542fa59f37;hpb=208db683069afb57aeb0ef0e6897c014b870bb6f diff --git a/examples-codegen/example1-client/client.cpp b/examples-codegen/example1-client/client.cpp index e35799e..d0a5ebe 100644 --- a/examples-codegen/example1-client/client.cpp +++ b/examples-codegen/example1-client/client.cpp @@ -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; }