资源简介
windows平台下对于服务器高并发的网络模型选型中,使用libevent是个不错的选择。
本文的背景基于:国内博客对于libevent大多介绍Linux实现,大多是C语言的实现,Windows平台下C++相对较少或者较旧。
本文针对libevent从服务端、客户端两个角度实现了封装类,真正做到,我们在使用封装类时候,只需要关注业务逻辑的处理,不需要关注socket的通信的细节。
代码片段和文件信息
// simLibeventClient.cpp : 定义控制台应用程序的入口点。
//
#include “stdafx.h“
#include “yuLibEventClient.h“
/*
**@author: laoyang360
**@date: 20161211
**@brief: The client of SimLibeventClient
*/
static const int s_iPort = 9999;
int main(int argc char** argv)
{
YuLibeventClient myLibClient;
myLibClient.init(s_iPort);
myLibClient.start();
myLibClient.stop();
printf(“finished \n“);
system(“pause“);
return 0;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 256 2016-12-11 22:52 libevent_demo\readme.txt
文件 205312 2016-12-11 21:51 libevent_demo\simLibeventClient\Debug\simLibeventClient.exe
文件 406 2016-12-11 17:40 libevent_demo\simLibeventClient\Debug\simLibeventClient.exe.manifest
文件 733144 2016-12-11 21:51 libevent_demo\simLibeventClient\Debug\simLibeventClient.ilk
文件 1059840 2016-12-11 21:51 libevent_demo\simLibeventClient\Debug\simLibeventClient.pdb
文件 46858240 2016-12-11 20:32 libevent_demo\simLibeventClient\ipch\simlibeventclient-b3a71e0f\simlibeventclient-b980e3ad.ipch
文件 2548 2016-12-11 21:51 libevent_demo\simLibeventClient\simLibeventClient\Debug\cl.command.1.tlog
文件 47014 2016-12-11 21:51 libevent_demo\simLibeventClient\simLibeventClient\Debug\CL.read.1.tlog
文件 2416 2016-12-11 21:51 libevent_demo\simLibeventClient\simLibeventClient\Debug\CL.write.1.tlog
文件 2018 2016-12-11 21:51 libevent_demo\simLibeventClient\simLibeventClient\Debug\li
文件 4002 2016-12-11 21:51 libevent_demo\simLibeventClient\simLibeventClient\Debug\li
文件 1200 2016-12-11 21:51 libevent_demo\simLibeventClient\simLibeventClient\Debug\li
文件 566 2016-12-11 21:51 libevent_demo\simLibeventClient\simLibeventClient\Debug\mt.command.1.tlog
文件 398 2016-12-11 21:51 libevent_demo\simLibeventClient\simLibeventClient\Debug\mt.read.1.tlog
文件 398 2016-12-11 21:51 libevent_demo\simLibeventClient\simLibeventClient\Debug\mt.write.1.tlog
文件 1819 2016-12-11 17:40 libevent_demo\simLibeventClient\simLibeventClient\Debug\simLibeventClient.Build.CppClean.log
文件 381 2016-12-11 21:51 libevent_demo\simLibeventClient\simLibeventClient\Debug\simLibeventClient.exe.intermediate.manifest
文件 72 2016-12-11 21:51 libevent_demo\simLibeventClient\simLibeventClient\Debug\simLibeventClient.lastbuildstate
文件 2360 2016-12-11 21:51 libevent_demo\simLibeventClient\simLibeventClient\Debug\simLibeventClient.log
文件 50795 2016-12-11 21:51 libevent_demo\simLibeventClient\simLibeventClient\Debug\simLibeventClient.obj
文件 1179648 2016-12-11 17:40 libevent_demo\simLibeventClient\simLibeventClient\Debug\simLibeventClient.pch
文件 707 2016-12-11 21:47 libevent_demo\simLibeventClient\simLibeventClient\Debug\simLibeventClient.vcxprojResolveAssemblyReference.cache
文件 0 2016-12-11 17:40 libevent_demo\simLibeventClient\simLibeventClient\Debug\simLibeventClient.write.1.tlog
文件 12275 2016-12-11 17:40 libevent_demo\simLibeventClient\simLibeventClient\Debug\stdafx.obj
文件 748544 2016-12-11 21:51 libevent_demo\simLibeventClient\simLibeventClient\Debug\vc100.idb
文件 356352 2016-12-11 21:51 libevent_demo\simLibeventClient\simLibeventClient\Debug\vc100.pdb
文件 65594 2016-12-11 21:47 libevent_demo\simLibeventClient\simLibeventClient\Debug\yuLibEventClient.obj
文件 30737 2016-12-11 18:10 libevent_demo\simLibeventClient\simLibeventClient\include\event2\buffer.h
文件 28619 2016-12-11 11:17 libevent_demo\simLibeventClient\simLibeventClient\include\event2\bufferevent.h
文件 4448 2012-02-11 06:17 libevent_demo\simLibeventClient\simLibeventClient\include\event2\bufferevent_compat.h
............此处省略131个文件信息
相关资源
- c++封装好的IP的获取和修改源码,通过
- HTTP上传和C++封装类支持GET、POST多种方
- hiredis的c++封装, 线程安全
- C++封装的一个跨平台的线程类和锁类
- tcp udp 底层c++封装类windows和linux
- 一个Oracle OCI编程接的C++封装,有OCI的
- C++封装mp3文件转wav文件的DLL
- c++封装curl,实现getpostdownload
- linux操作系统下C++封装的基础库
- libevent源码深度剖析 + libevent参考手册
- libevent源码深度剖析
- 基于libevent 实现的http服务C++(myhttp
- DES加解密源码(C++封装及)
- c++封装libev
- 用C++封装的CRandom类
- mysql c++封装类库 方便mysql编程
评论
共有 条评论