| 1 | #include <socket_server.hxx> |
| 2 | #include <command_server.hxx> // for group_command_server |
| 3 | |
| 4 | // the automatically generated server side code (cmd_group_t2nexample class) |
| 5 | #include "t2nexample_server.hxx" |
| 6 | |
| 7 | int main(int argc, char** argv) |
| 8 | { |
| 9 | // don't kill the server on broken pipe |
| 10 | signal(SIGPIPE, SIG_IGN); |
| 11 | |
| 12 | // create local socket server (a.k.a "unix domain socket") |
| 13 | // if you want to to create a tcp/ip server you pass the port to the constructor |
| 14 | // (for details take a look at the socket_server class documentation) |
| 15 | libt2n::socket_server ss("./socket"); |
| 16 | libt2n::group_command_server<cmd_group_t2nexample> cs(ss); |
| 17 | |
| 18 | // handle requests |
| 19 | while(true) |
| 20 | cs.handle(); |
| 21 | |
| 22 | return 0; |
| 23 | } |