1 // for socket_client_connection
2 #include <socket_client.hxx>
4 // include generated library header
5 #include "t2nexample_client.hxx"
7 int main(int argc, char** argv)
9 // use a local socket (a.k.a "unix domain socket")
10 // if you want to connect to a tcp/ip server you pass the port and server name to the constructor
11 libt2n::socket_client_connection sc("./socket");
12 // this generated class has a method for each of our exported procedures
13 cmd_group_t2nexample_client cc(&sc);
17 // exceptions are passed back to the client transparently
20 // call the remote procedure (we pass "throw" to cause a exception to be thrown)
23 catch(libt2n::t2n_runtime_error &e)
25 throwok=(std::string(e.what())=="throw me around");
28 // call remote procedure and check the return value is correct
29 return ( throwok && ( cc.testfunc("hello") == "hello, testfunc() was here" ) )
30 ? EXIT_SUCCESS : EXIT_FAILURE;