-
一个线程池的一个类,基本使用如下:
一个线程驰的类, 下面的是基本的使用方法 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
-
取硬盘物理序列号
取硬盘物理序列号-drive from the physical sequence,
- 2022-07-16 12:38:23下载
- 积分:1
-
针对硬件的测试程序,用于测试某种IC的功能测试,
针对硬件的测试程序,用于测试某种IC的功能测试,-For hardware testing procedures for testing the function of some kind of IC testing,
- 2022-02-26 10:52:12下载
- 积分:1
-
Asp.Net FileTrans
Asp.Net FileTrans
- 2022-04-22 03:43:56下载
- 积分:1
-
on entropy coding code
关于熵编码的代码-on entropy coding code
- 2022-02-05 08:10:10下载
- 积分:1
-
This is a code that can read the documents in PE header, very practical.
这是一个代码,可以读取PE文件的文件头信息,非常实用.-This is a code that can read the documents in PE header, very practical.
- 2023-05-13 20:30:02下载
- 积分:1
-
Computer Level II exams can be used C language, C language beginners can also us...
计算机二级C言语等级考试可用,C言语初学者也可以使用-Computer Level II exams can be used C language, C language beginners can also use the
- 2022-02-02 04:32:23下载
- 积分:1
-
Windows PE用于分析文件,我们可以看到,它取决于什么…
一个用于分析windows PE文件的程序,可以知道其依赖于其他什么文件。里面使用了boost库的功能,可以简化链接符号的处理。-A windows PE used to analyze the documents, we can see that its dependent on what other documents. Inside the library using the boost function, the link can be simplified treatment symbols.
- 2022-05-27 14:28:48下载
- 积分:1
-
Windows Mobile development document
Windows Mobile development document
- 2022-05-23 21:13:11下载
- 积分:1
-
读取住册表的例子
读取住册表的例子-read live CLSID example
- 2022-06-02 15:17:22下载
- 积分:1