libt2n: (gerd) fixes & testcase
[libt2n] / test / server.cpp
diff --git a/test/server.cpp b/test/server.cpp
new file mode 100644 (file)
index 0000000..f5a0349
--- /dev/null
@@ -0,0 +1,41 @@
+/***************************************************************************
+ *   Copyright (C) 2006 by Gerd v. Egidy                                   *
+ *   gve@intra2net.com                                                     *
+ *                                                                         *
+ *   This library is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU Lesser General Public License version   *
+ *   2.1 as published by the Free Software Foundation.                     *
+ *                                                                         *
+ *   This library is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU Lesser General Public License for more details.                   *
+ *                                                                         *
+ *   You should have received a copy of the GNU Lesser General Public      *
+ *   License along with this program; if not, write to the                 *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#include <socket_server.hxx>
+
+using namespace std;
+using namespace libt2n;
+
+int main()
+{
+    socket_server ss("./socket");
+
+    while(true)
+    {
+        ss.fill_buffer(1000000);
+
+        unsigned int cid;
+        string data;
+
+        while(ss.get_packet(data,cid))
+            cout << "conn " << cid << ": " << data << endl;
+    }
+
+    return 0;
+}