init commit master
authorPeng Li <seudut@gmail.com>
Mon, 4 Jun 2018 16:33:15 +0000 (00:33 +0800)
committerPeng Li <seudut@gmail.com>
Mon, 4 Jun 2018 16:33:15 +0000 (00:33 +0800)
TCPServer.cpp [new file with mode: 0644]
TCPServer.h [new file with mode: 0644]
main.cpp [new file with mode: 0644]

diff --git a/TCPServer.cpp b/TCPServer.cpp
new file mode 100644 (file)
index 0000000..40e2516
--- /dev/null
@@ -0,0 +1,16 @@
+#include "TCPServer.h"
+#include <sys/socket.h>
+#include <iostream>
+
+TCPServer::TCPServer()
+{
+}
+
+TCPServer::~TCPServer()
+{
+}
+
+void TCPServer::onRecv(const std::stringstream& ss)
+{
+    std::cout << ss.str() << std::endl;
+}
diff --git a/TCPServer.h b/TCPServer.h
new file mode 100644 (file)
index 0000000..b51bc66
--- /dev/null
@@ -0,0 +1,11 @@
+#include <sstream>
+
+class TCPServer 
+{
+public:
+    TCPServer();
+    ~TCPServer();
+    virtual void onRecv(const std::stringstream& ss);
+private:
+};
+
diff --git a/main.cpp b/main.cpp
new file mode 100644 (file)
index 0000000..6291375
--- /dev/null
+++ b/main.cpp
@@ -0,0 +1,16 @@
+#include "TCPServer.h"
+#include<sstream>
+#include<iostream>
+
+class MyServer : public TCPServer
+{
+    void onRecv(const std::stringstream& ss){
+        std::cout << "wowo" << ss.str() << std::endl;
+    }
+};
+
+int main()
+{
+//TCPServer server("127.0.0.1", 9999);
+    MyServer s ;
+}