test to pass group as attribute to gccxml
[libt2n] / examples / minimalistic-server.cpp
... / ...
CommitLineData
1/***************************************************************************
2 * Copyright (C) 2004 by Intra2net AG *
3 * info@intra2net.com *
4 * *
5 ***************************************************************************/
6
7#include <string>
8#include "minimalistic-stub.hxx"
9
10#include <socket_server.hxx>
11#include <command_server.hxx>
12
13using namespace std;
14
15LIBT2N_EXPORT_GROUP(example) string testfunc(const string& str)
16{
17 string ret;
18 if (str=="throw")
19 throw libt2n::t2n_runtime_error("throw me around");
20 if (str=="big")
21 ret.insert(0,100*1024,'x');
22 else
23 ret=str+", testfunc() was here";
24 return ret;
25}
26
27using namespace libt2n;
28
29int main(int argc, char** argv) {
30 extended_type_info_test();
31
32 socket_server ss("./socket");
33 group_command_server<cmd_group_example> cs(ss);
34
35 // handle requests (without timeout)
36 while(true)
37 cs.handle();
38
39 return 0;
40}