libt2n: (gerd) add lots of error handling code, unit tests for this error handling...
[libt2n] / examples-codegen / example1 / server.cpp
index f392e03..528eabc 100644 (file)
@@ -4,15 +4,20 @@
 // the automatically generated server side code (cmd_group_t2nexample class)
 #include "t2nexample_server.hxx"
 
-int main(int argc, char** argv) {
-  // create local socket server (a.k.a "unix domain socket")
-  // if you want to to create a tcp/ip server you pass the port to the constructor (for details take a look at the socket_server class documentation)
-  libt2n::socket_server ss("./socket");
-  libt2n::group_command_server<cmd_group_t2nexample> cs(ss);
+int main(int argc, char** argv)
+{
+    // don't kill the server on broken pipe
+    signal(SIGPIPE, SIG_IGN);
 
-  // handle requests
-  while(true)
-    cs.handle();
+    // create local socket server (a.k.a "unix domain socket")
+    // if you want to to create a tcp/ip server you pass the port to the constructor
+    // (for details take a look at the socket_server class documentation)
+    libt2n::socket_server ss("./socket");
+    libt2n::group_command_server<cmd_group_t2nexample> cs(ss);
 
-  return 0;
+    // handle requests
+    while(true)
+        cs.handle();
+
+    return 0;
 }