-
一个线程池的一个类,基本使用如下:
一个线程驰的类, 下面的是基本的使用方法 struct TSession { SOCKET socket int id } class myIocp:public CIOCP { public: void OnRead(void * p, char * buf, int len) void OnAccept(SOCKET socket) void OnClose(void * p) } void myIocp::OnAccept(SOCKET socket) { TSession *s = new TSession s->socket = socket //这里可以对连接的session进行自己的操作,例如给id找一个唯一的值 SetIoCompletionPort(socket, s) // 使连接socket与一个自定义结构体关联 } void myIocp::OnRead(void * p, char * buf, int len) { TSession *s = (TSession *)p send(s->socket, buf, len, 0) // 这里只是简单的把收到的消息返回给客户端 ... } void myIocp::OnClose(void * p) { delete p } myIoncp iocp main() { ... iocp.listen(4311) // 开始监听网络端口,等待客户端连接 ... }-A class for thread pool,basic usage below:
struct TSession { SOCKET socket int id } class myIocp:public CIOCP
{ public:
void OnRead(void* p, char* buf, int len)
void OnAccept(SOCKET socket)
void OnClose(void* p) }
void myIocp::OnAccept(SOCKET socket)
{ TSession*s = new TSession s->socket = socket
//here you can do something about connecti
- 2022-07-17 05:14:52下载
- 积分:1
-
VisualC++编程技巧与范例
VisualC++编程技巧与范例-Visual C programming skills and examples
- 2022-04-28 15:17:48下载
- 积分:1
-
使用单独线程实现的计时器
使用单独线程实现的计时器-The example of implementing times using single thread
- 2022-04-19 19:06:32下载
- 积分:1
-
PCI 9050/9052 driver for windows xp
PCI 9050/9052 driver for windows xp
安裝硬體裝置時需要
直接更新驅動程式即可
- 2023-08-08 20:05:02下载
- 积分:1
-
acasscascs
你好,我的朋友
- 2023-07-09 17:50:03下载
- 积分:1
-
使用API产生动态鼠标的例子,文件:animouse.rar
使用API产生动态鼠标的例子,文件:animouse.rar-API dynamically generated using the mouse example, file: animouse.rar
- 2022-03-22 01:38:31下载
- 积分:1
-
svm+sift
对遥感图像中目标识别分割算法进行研究,是一种监督学习算法。首先具体介绍了尺度不变特征变换、词典模型和支持向量机的原理、实现的具体步骤和优越性,并对SVM非线性分类中核函数的重要作用进行了深入研究,之后使用基于SIFT的支持向量机分割算法对目标识别进行了实验。
- 2022-01-26 03:37:24下载
- 积分:1
-
The purpose is to guide the detailed design codes, specifically, is that your de...
详细设计的目的就是指导编码,明确的说,就是将你的设计拿给不同的人去写编码,写出来的程序处理流程相同.后续的评审或者是有人接替你的工作,只要查看详细设计,就能清楚你当时是怎样设计这些流程的。-The purpose is to guide the detailed design codes, specifically, is that your design showed that different people to write code, written procedures for processing the same. Follow-up assessment or someone to replace your job, as long as View the detailed design, we can clearly understand how did you design these processes.
- 2023-03-22 16:45:03下载
- 积分:1
-
药店管理系统软件
药店管理系统软件-pharmacy management system software
- 2022-01-30 16:11:53下载
- 积分:1
-
C# 使用 wxSQLite
使用系统;使用系统数据;使用System.Runtime.InteropServices;命名空间SQLiteTutorial{公共类SQLiteException:异常{公共SQLiteException(字符串消息):{基(消息)}
- 2022-01-24 13:01:22下载
- 积分:1