joyzou / libevlite Goto Github PK
View Code? Open in Web Editor NEWThis project forked from shenyanjun/libevlite
the lite version of libevent
License: BSD 2-Clause "Simplified" License
This project forked from shenyanjun/libevlite
the lite version of libevent
License: BSD 2-Clause "Simplified" License
libevlite网络通信库(Linux, Darwin, *BSD) 1. 基础事件模块( include/event.h ), 支持的IO复用机制: epoll和kqueue 1) 类型说明: 1> 事件类型说明: 读事件(EV_READ), 写事件(EV_WRITE), 超时事件(EV_TIMEOUT) 在三种事件类型的基础上, 支持事件驻留在事件集中的永久模式(EV_PERSIST) 2> 网络事件event_t 3> 网络事件集evsets_t 2) 基于事件(event_t)的方法说明: 1> 设置事件属性 event_set() 2> 设置事件回调函数 event_set_callback() 3) 基于事件集(evsets_t)的方法说明: 1> 向事件集中添加事件 evsets_add() 2> 从事件集中删除事件 evsets_del() 3> 分发并处理事件 evsets_dispatch() 2. 网络线程模块( include/threads.h ) 3. 通信模块( include/networks.h ) 1) 创建网络通信层 iolayer_create() nthreads: 指定网络线程的个数 nclients: 推荐连接数 immediately: 数据是否会立刻推送到网络层,对实时性要求很高的场景, 建议设置为1 2) 设置网络通信层的方法(非线程安全) 设置线程上下文: iolayer_set_iocontext(), 设置网络层数据改造方法: iolayer_set_transform() 3) 监听端口/开启服务端 iolayer_listen() 此处存在一次性内存泄漏(272bytes) 4) 连接远程服务/开启客户端 iolayer_connect() 5) 关联描述符的读写事件 iolayer_associate() 6) 设置回话的方法 设置会话的超时时间 iolayer_set_timeout() 设置会话的保活时间 iolayer_set_keepalive() 设置会话的IO服务逻辑 iolayer_set_service() 7) 发送数据 iolayer_send() 8) 广播数据 iolayer_broadcast(), iolayer_broadcast2() 9) 关闭会话 iolayer_shutdown(), iolayer_shutdowns() 10) 停止服务 iolayer_stop() 停止行为定义: 1> 停止对外提供接入服务, 不再接受新的连接; 2> 停止所有连接的接收服务, 不再回调ioservice_t::process() 11) 提交任务 iolayer_perform(), iolayer_perform2() 12) 销毁网络层 iolayer_destroy()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.