Added libt2n-gccxml.sh wrapper script to filter new, unknown gccxml -pthread option
[libt2n] / examples-codegen / example2 / server.cpp
index 2049f5a..267e823 100644 (file)
@@ -16,6 +16,8 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
+#include <signal.h>
+
 #include <socket_server.hxx>
 #include <command_server.hxx>
 
 using namespace libt2n;
 
 
-int main(int argc, char** argv) {
-  socket_server ss("./socket");
-  socket_server ss_other("./socket_other");
-  group_command_server<cmd_group_default> cs(ss);
-  group_command_server<cmd_group_other> cs_other(ss_other);
+int main(int argc, char** argv)
+{
+    // don't kill the server on broken pipe
+    signal(SIGPIPE, SIG_IGN);
+
+    socket_server ss("./socket");
+    socket_server ss_other("./socket_other");
+    group_command_server<cmd_group_default> cs(ss);
+    group_command_server<cmd_group_other> cs_other(ss_other);
 
-  // handle requests
-  while(true) {
-    cs.handle(1000);
-    cs_other.handle(1000);
-  }
+    // handle requests
+    while(true)
+    {
+        cs.handle(1000);
+        cs_other.handle(1000);
+    }
 
-  return 0;
+    return 0;
 }