libt2n: (gerd) add lots of error handling code, unit tests for this error handling...
[libt2n] / examples / minimalistic-server.cpp
index 39826f2..19114b4 100644 (file)
@@ -17,6 +17,8 @@
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
 
+#include <signal.h>
+
 #include <string>
 #include "minimalistic-stub.hxx"
 
@@ -41,15 +43,19 @@ LIBT2N_EXPORT std::string testfunc(const string& str)
 
 using namespace libt2n;
 
-int main(int argc, char** argv) {
-  extended_type_info_test();
+int main(int argc, char** argv)
+{
+    extended_type_info_test();
+
+    // don't kill us on broken pipe
+    signal(SIGPIPE, SIG_IGN);
 
-  socket_server ss("./socket");
-  group_command_server<cmd_group_example> cs(ss);
+    socket_server ss("./socket");
+    group_command_server<cmd_group_example> cs(ss);
 
-  // handle requests (without timeout)
-  while(true)
-    cs.handle();
+    // handle requests (without timeout)
+    while(true)
+        cs.handle();
 
-  return 0;
+    return 0;
 }