登录
首页 » Windows开发 » 一个线程池的一个类,基本使用如下:

一个线程池的一个类,基本使用如下:

于 2022-07-17 发布 文件大小:2.64 kB
0 131
下载积分: 2 下载次数: 1

代码说明:

一个线程驰的类, 下面的是基本的使用方法 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

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • “五子棋”这个程序是部分的,它是博弈树搜索…
    本“五子棋“程序只编写了人机对弈部分,运用了博弈树进行搜索,在选取最优的走步时使用极大极小分析法,考虑到搜索的时间复杂度和空间复杂度,在程序中只进行了2步搜索,即计算机在考虑下一步的走法时,只对玩家进行一步的推测。(程序中的棋盘规格为15*15)-" quintet game " this procedure is it is it partly , is it play chess tree search for to use to play chess while being man-machine to write only, use the great extremely small analytic approach while choosing the optimum walking, consider time complexity and space complexity searched for, only search for 2 steps in the procedure , namely the computer, while considering next walking in France,
    2022-01-22 11:03:50下载
    积分:1
  • 一个聊天程序, 包括server and client使用windows socket原理, 是学习网络编程的好demo...
    一个聊天程序, 包括server and client使用windows socket原理, 是学习网络编程的好demo-a chat program, including the use of server and client socket windows theory, learning is a good network programming demo
    2022-03-26 00:35:10下载
    积分:1
  • 本程序主要实现对音量的控制和实现。调用了windows的dll文件。...
    本程序主要实现对音量的控制和实现。调用了windows的dll文件。-the main procedures for the control of noise and realized. Calling the windows of the dll file.
    2023-07-05 18:10:03下载
    积分:1
  • 通过模拟按键winIO接口的信息,其中有驱动的使用…
    模拟按键 信息通过winio接口实现,里面有驱动源码 和 使用例子-Information through the analog button winio interface, which has driven the use of source and example
    2022-03-20 16:12:40下载
    积分:1
  • Visual C++.NET 数据库指南5
    Visual C++.NET 数据库开发指南5-Visual C++. NET Database Developer" s Guide 5
    2022-05-13 08:33:24下载
    积分:1
  • Simpletron
    这是一个执行所有功能的simpletron程序进来。这个是一个执行所有功能的simpletron程序进来。这个是一个执行所有功能的simpletron程序进来。这个是一个执行所有功能的simpletron程序进来。这个是一个执行所有功能的simpletron程序进来。这个simpletron程序执行所有功能进来。这个是一个执行所有功能的simpletron程序进来。这个是一个执行所有功能的simpletron程序进来。这个是一个simpletron程序,执行中的所有功能。
    2023-08-12 10:05:04下载
    积分:1
  • 介绍打位图的方法及位图的一些相关操作。
    介绍打开位图的方法及位图的一些相关操作。-this is a very important homework which can make you know the way to open the picture with VC
    2022-01-26 02:14:07下载
    积分:1
  • 实现正则表达式匹配。匹配速度很快,可以很方便的嵌入到自己的程序...
    实现正则表达式匹配。匹配速度很快,可以很方便的嵌入到自己的程序-The realization of regular expression matching. Fast.
    2022-05-28 01:11:19下载
    积分:1
  • 键盘操作捕获(键盘钩子)
    实现键盘操作的捕获。WIN32汇编,将捕获的操作记录中文件当中。
    2023-06-11 23:50:08下载
    积分:1
  • ppc下的evc编程,通过gdi操作,画2d图形
    ppc下的evc编程,通过gdi操作,画2d图形-EVC programming under ppc by gdi operations, drawing 2d graphics
    2023-08-30 06:30:04下载
    积分:1
  • 696518资源总数
  • 106242会员总数
  • 10今日下载