From a17738e1545ff7dbef6398b8ec1eab93ab59c9a1 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期四, 30 六月 2022 19:14:47 +0800
Subject: [PATCH] '功能完善'

---
 app/SocketManager.h |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/app/SocketManager.h b/app/SocketManager.h
index 9de0f78..9e7c487 100644
--- a/app/SocketManager.h
+++ b/app/SocketManager.h
@@ -10,12 +10,21 @@
 #include "framework.h"
 #include <atlstr.h>
 using namespace std;
+
+#define LOCAL_SERVER_ADDR "127.0.0.1"
+#define LOCAL_SERVER_PORT 9006
+
+typedef bool (*ActionCallback)(string data, void* contex);
+
 class SocketManager
 {
 
 
 private:
 	list<SOCKET> sockClients;
+	static SOCKET socketServer;
+	static void runSocketServer(void* context);
+	static void processMsg(SOCKET  client, void* context);
 	const int PORT = 9001;
 	const char* ADDR = "127.0.0.1";
 	sockaddr_in clientaddr;
@@ -23,13 +32,14 @@
 	//添加客户端
 	void addClient(int p);
 
-
+	static void* callbackContext;
+	static ActionCallback actionCallback;
 
 public:
-	SocketManager();
+	SocketManager(ActionCallback callback,void * context);
 	~SocketManager();
 
-	void init();
+	void init(ActionCallback callback, void* contex);
 
 	int getClientsNum();
 
@@ -41,7 +51,7 @@
 	void disConnect();
 	int disConnect(int p);
 
-	BOOL sendMsg(int,char *);
+	BOOL sendMsg(int, const char *);
 
 
 };

--
Gitblit v1.8.0