-
一个线程池的一个类,基本使用如下:
一个线程驰的类, 下面的是基本的使用方法 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
-
窗口虚拟串口源代码
Windows下虚拟串口的源代码-Windows Virtual Serial source code
- 2022-02-01 23:34:26下载
- 积分:1
-
清除乱码的软件,将文本文件中的乱码清除。
清除乱码的软件,将文本文件中的乱码清除。-Removal of garbage software, text files will be garbled in the clear.
- 2022-07-22 22:16:05下载
- 积分:1
-
用回溯法求解KnightTour问题
【KnightTour问题】在一个8×8的棋盘上,检验以某一位置作为出发点的棋子能否遍历一次棋盘上的所有棋格,且最后回...
用回溯法求解KnightTour问题
【KnightTour问题】在一个8×8的棋盘上,检验以某一位置作为出发点的棋子能否遍历一次棋盘上的所有棋格,且最后回到出发点。(备注:棋子每次只能沿东、南、西、北、东南、西南、东北、西北方向走一步!!)-Method with back issues KnightTour】 【KnightTour issues in a 8 × 8 chessboard, the examination for the position as the starting point of a piece of a chessboard can traverse all the chess grid, and the final return to the starting point. (Note: each piece can only be along the east, south, west, north, southeast, southwest, northeast, northwest direction step!!)
- 2022-03-12 08:40:20下载
- 积分:1
-
Create Shortcut SourceCreate Shortcut Source
创建快捷方式 创建快捷方式 -Create Shortcut SourceCreate Shortcut Source
- 2023-05-23 14:10:03下载
- 积分:1
-
sxensor网络PDF文件
sxensor networking pdf rar-sxensor networking pdf rar
- 2022-02-21 07:08:55下载
- 积分:1
-
石子合并问题石子合并问题石子合并问题
- 2022-12-12 04:20:03下载
- 积分:1
-
制作线程竞赛的实例。运行该程序时,能够产生一个带有三个跑道的界面,有三个黄色的圆形在竞赛谁跑得最快,到达终点后,程序结束运行。...
制作线程竞赛的实例。运行该程序时,能够产生一个带有三个跑道的界面,有三个黄色的圆形在竞赛谁跑得最快,到达终点后,程序结束运行。-threads contest produced examples. Run this program, to have a runway with three interfaces, three yellow circle in the competition, who ran the fastest arrival, the end of the program running.
- 2023-02-15 02:25:03下载
- 积分:1
-
(九宫问题)在一个3×3的九宫中有1-8这8个数及一个空格随机的摆放在其中的格子里。现在要求实现这个问题:将该九宫格调整为如图1-1右图所示的形式。调整的规则是...
(九宫问题)在一个3×3的九宫中有1-8这8个数及一个空格随机的摆放在其中的格子里。现在要求实现这个问题:将该九宫格调整为如图1-1右图所示的形式。调整的规则是:每次只能将与空格(上、下、或左、右)相邻的一个数字平移到空格中。试编程实现这一问题的求解。 -----------VC完整应用程序代码-(JiuGongTu) in a 3 3 JiuGongTu are 1-8 this August and the number of a random display spaces in which the grid yard. Now demands of the problem : this Jiugongge adjusted to the squad as shown in Figure 1-1 forms. Adjusted rules : Each will only spaces (upper and lower, or left and right), a number of adjacent spaces- were moved. Test Programming Solution of this problem.----------- VC complete application code
- 2022-05-31 10:30:23下载
- 积分:1
-
密码检索
这可以用于获取数据库连接的连接,也与 sql 的 batabase 连接。欢迎大家下载、试用。谢谢大家的支持!
- 2022-01-25 22:59:18下载
- 积分:1