Location:
Search - onClose
Search list
Description: 一个线程驰的类, 下面的是基本的使用方法 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 connection session,such as find a unique id.
SetIoCompletionPort(socket, s)
// make connection socket associate with a custom structure }
void myIocp::OnRead(void * p, char * buf, int len)
{ TSession *s = (TSession *)p send(s->socket, buf, len, 0)
// return received message to client
void myIocp::OnClose(void * p) { delete p } myIoncp iocp main() { ... iocp.listen(4311)
//start listenning net port,wait for client connect.
Platform: |
Size: 2701 |
Author: boxu |
Hits:
Description: 封装 API 中窗口处理的数据结构和相关函数
提供两类成员函数:
窗口 API 函数:代替 SDK API 函数
消息响应函数:响应各种系统消息
窗口 API 函数例
ShowWindow、ScrollWindow、SetWindowText
消息响应函数例
OnPaint、OnLButtonDown、OnKeyUp、
OnMouseMove、OnClose、OnHScro-Packaging API window of data structure and related functions for both categories of membership function : Windows API functions : to replace the SDK API functions news response function : Responding to various information systems window cases ShowWindow API function, ScrollWindow, SetWindowText news cases OnPaint response function, OnLButtonDown, OnKeyUp, OnMouseMove , OnClose, OnHScro
Platform: |
Size: 16819 |
Author: ssys |
Hits:
Description: 一个线程驰的类, 下面的是基本的使用方法 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 connection session,such as find a unique id.
SetIoCompletionPort(socket, s)
// make connection socket associate with a custom structure }
void myIocp::OnRead(void* p, char* buf, int len)
{ TSession*s = (TSession*)p send(s->socket, buf, len, 0)
// return received message to client
void myIocp::OnClose(void* p) { delete p } myIoncp iocp main() { ... iocp.listen(4311)
//start listenning net port,wait for client connect.
Platform: |
Size: 2048 |
Author: boxu |
Hits:
Description: 封装 API 中窗口处理的数据结构和相关函数
提供两类成员函数:
窗口 API 函数:代替 SDK API 函数
消息响应函数:响应各种系统消息
窗口 API 函数例
ShowWindow、ScrollWindow、SetWindowText
消息响应函数例
OnPaint、OnLButtonDown、OnKeyUp、
OnMouseMove、OnClose、OnHScro-Packaging API window of data structure and related functions for both categories of membership function : Windows API functions : to replace the SDK API functions news response function : Responding to various information systems window cases ShowWindow API function, ScrollWindow, SetWindowText news cases OnPaint response function, OnLButtonDown, OnKeyUp, OnMouseMove , OnClose, OnHScro
Platform: |
Size: 16384 |
Author: ssys |
Hits:
Description: windows系统下的一个基于WS2_32.lib的socket网络框架,与CAsyncSOcket类不一样的地方是它可以跨线程使用,采用select模型实现socket通讯,具有常见的事件方法,比如OnClose,OnAccept,OnReceive,OnSend等事件通知,还有常用的send等发送数据接口,简单易用。欢迎大家使用,也欢迎改进改软件框架。-1.base on S2_32.lib
2.select model
3.event model.
4.easy to use
Platform: |
Size: 4096 |
Author: fangta |
Hits:
Description: 服务器程序员开发最关心的其实只有3件事情,新连接到达,数据到达,连接断开。
mdk就是基于以上3个主要业务,为服务器设计了OnConnect() OnMsg() OnClose()3个主要回调方法,用户的主要的工作就是实现这3个方法,所以我将这种开发模式命名为面向业务的开发。
用户不再关心底层各种繁杂的处理,比如线程模型,各种同步,内部对象生命周期,各种缓冲只要专心写业务就好
整个框架代码大约5000行,希望不会给大家造成阅读负担,
希望这款服务器能给大家带来更多便利。-Server programmers to develop the most concerned about, in fact, only three things, the new connection arrives, data arrive is disconnected. mdk is based on three main business is designed for the server the the OnConnect () the OnMsg () OnClose () the three main callback method, the user' s main work is to achieve three, so I will this development model named business-oriented development. Users no longer care about the underlying various complicated processing, such as threading model, various synchronization the internal object life cycle, various buffer concentrate on writing the business like the whole framework code is about 5000 lines, hope it will not cause reading burden to everyone, hope this server we can bring more convenience.
Platform: |
Size: 152576 |
Author: 零点 |
Hits:
Description: 创建监听器对象
创建组件对象(并绑定监听器)
启动组件
连接远程主机(仅用于Agent组件)
处理通信事件(OnConnect/OnReceive/OnClose ......)
停止组件(可选,第7步销毁组件对象前会先停止组件)
销毁组件对象
销毁监听器对象(Create a listener object
Create component objects (and bind the listener)
Startup component
Connect to a remote host (only for Agent components)
Handling communication events (OnConnect/OnReceive/OnClose...).
Stop components (optional, seventh steps to destroy components before stopping components).
Dstroy component objects
Destroy the listener object)
Platform: |
Size: 1024 |
Author: 呦呵. |
Hits: