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

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

于 2022-07-17 发布 文件大小:2.64 kB
0 129
下载积分: 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 个回复

  • 使用ode45函数,计算双摆模型,同时动画显示结果。并画图相应的相图....
    使用ode45函数,计算双摆模型,同时动画显示结果。并画图相应的相图. -use ode45 function, double pendulum model calculation, the results show animation. Drawing and the corresponding phase diagram.
    2022-09-28 19:10:03下载
    积分:1
  • 局域网 聊天程序 源码
    资源描述 资源描述 资源描述 局域网 聊天程序 源码 是Windows Socket编程,采用VC++编写,代码分为server端 和 client端两部分 ,,代码说明详细,,,,为网络编程初步开发,,,,,,,,,,,,,,,,,,,,,,
    2022-03-22 19:07:22下载
    积分:1
  • 自己的小程序!请看一下!自己写的小程序
    自己的小程序!请看一下!自己写的小程序-own small program! See what! His writing small programs
    2022-01-28 20:17:37下载
    积分:1
  • 音乐播放器
    在windows下qt下开发的源代码,可以正常运行。可以实现歌曲的播放,上一曲,下一曲及歌词显示。基本功能都实现了,且界面比较美观,作为qt初学者来说是不错的学习资料。
    2022-09-30 15:10:03下载
    积分:1
  • 多功能计算软件程序清单 功能要求:具备整型数据、浮点型数据的算术(加、减、乘、除)运算功能。 依次输入运算符(+,...
    多功能计算软件程序清单 功能要求:具备整型数据、浮点型数据的算术(加、减、乘、除)运算功能。 依次输入运算符(+,-,*,/)、第一个运算数、第二个运算数,然后输出结果, 当用户输入 Q 则退出系统,否则允许用户连续进行运算。-Multi-function calculation software program list functional requirements: with integer data, floating-point data arithmetic (add, subtract, multiply, divide) operator function. Followed by enter operator (+,-,*,/), the first operand, the second operand, and then output the result, when the user enters " Q" then exit the system, or allows the user to continuous operation.
    2022-08-21 02:26:38下载
    积分:1
  • Dialog对话框编程的例子
    Dialog对话框编程的例子-programming examples
    2023-09-03 11:10:03下载
    积分:1
  • 标题栏画标题栏
    采用VC++ MFC开发,实现位图自绘标题栏。在函数中PreCreateWindow取消Title Bar上的按钮,DrawTitleBar函数中重绘标题栏,非常有参考价值。
    2022-07-21 20:15:44下载
    积分:1
  • 1.Bios ID No. 2 Bios three types Bios date information OEM 4 5. Motherboard chip...
    1.Bios ID号2 Bios 类型3 Bios 日期4 OEM 信息5.主板芯片ID号读取代码以及dll 支持:win95/98/Me/NT/2000/XP MS Visual Studio(vc,vb,etc.) Borland Builders(C++ builder, Delphi, JBuilder) 通过com-java桥, BiosNt能够用于Java2环境中Power Builder-1.Bios ID No. 2 Bios three types Bios date information OEM 4 5. Motherboard chip ID code reader and dll support : win95/98/Me/NT/2000/XP MS Visual Studio (vc, vb, etc.). Borland Builders (C builder, Delphi, JBuilder) com- java bridge can be used Java2 BiosNt environment Power Builder
    2022-04-21 00:23:00下载
    积分:1
  • procedures in the VC++ environment prepared by the automatic use of non
    本程序是在VC++环境下编写的利用非确定自动机NFA进行字符串匹配-procedures in the VC++ environment prepared by the automatic use of non-identified plane NFA strings match
    2022-05-15 13:38:59下载
    积分:1
  • VC++ programming network sniffer
    VC++编程实现网络嗅探器 一个非常简单易懂的封包窃听程序附上源码注解 让你可以在短时间内了解封包窃听程序的原理 是非常不错的封包窃听的入门学习程序-VC++ programming network sniffer
    2022-09-20 21:50:03下载
    积分:1
  • 696518资源总数
  • 106164会员总数
  • 18今日下载