libevent

libevent在window下编译

北慕城南 提交于 2019-12-07 03:14:26
此文只因为自己经历所写,并非转帖或原创一说,因为大致编译方法都大同小异的。 环境: window 10 工具: visual studio 2013 版本: libevent-2.0.22-statble 过程: $VC_PATH : ...\vs2013\vc\bin $LIBEVENT_PATH: ...\libevent-2.0.22-stable a. 编译前准备: libevent源码中关于win32版本的描述,未必会与本机版本一致,所以,首先需要修改WIN32宏的版本值, 具体为一下三个文件修改, 加入语句 #define _WIN32_WINNT 0x0603 $LIBEVENT_PATH\event_iocp.c $LIBEVENT_PATH\evthread_win32.c $LIBEVENT_PATH\listener.c b. 部署编译工具: 命令行转至$VC_PATH下,首先部署vc编译器环境变量,执行vcvar32.bat脚本,成功之后路径 转至$LIBEVENT_PATH下,执行nmake Makefile.nmake,开始编译 c. 编译成功后将会生成以下三个lib文件: libevent.lib libevent_core.lib libevent_extras.lib 来源: oschina 链接: https://my.oschina.net/u

installation of libevent development libraries in ubuntu

社会主义新天地 提交于 2019-12-06 20:25:03
问题 I am using ubuntu 10.10 trying to install libevent development libraries libevent1 and libevent2. I used the below command- apt-get install libevent-dev libevent1-dev But it shows- Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package libevent1-dev Then i used- apt-get install libevent-dev But it says libevent-dev is already a newest version. Is that libevent2? I'm a root user. Am I doing anything wrong? Does ubuntu 10.10 support

hiredis-win32+libevent

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 16:43:23
决定用 redis作为cache服务器 ,要求其服务端和客户端都支持跨平台win和linux 但我发现redis(/作者)对windows态度极差,不考虑,不支持 微软公司的闲人们主动靠过去,推出win版。这么一来,redis的 服务端linux版和win版都有了,我就在我的win7上部署了一个win版的redis服务器做调试用,余不累赘,以后另起课题讨论 客户端用hiredis,其 win版(/往后简称winV)在 https://github.com/texnician/hiredis-win32 原版master(往后简称masterV)在 https://github.com/redis/hiredis 下载来之,解开, 对比 它两: 1、winV的examples.h/c直接和核心代码混在根目录上,组织乱 2、winV全面用预编译宏_WIN32来区分平台代码,另辟代码分别实现各个接口,网络方面的改动最大 3、winV除了新辟的代码,其它的 3.1 winV删除了keepalive的接口 3.2 其它的跟masterV区别不大,有些许改动 确保能编译winV 1、新建目录examples,把examples.h/c全赶进去 2、先不管winV其新辟的代码,把其它的改动,从masterV merge到 winV里 3、建立vc工程hiredis4win.vcxproj/sln

让Libevent 在window下 支持 IOCP

一笑奈何 提交于 2019-12-06 12:54:14
Libevent 的强大就不说了,但由于在window下使用的是 select 机制 ,除了效率低下意外还有一个讨厌的"FD_SETSIZE"限制,所以一直 希望能支持IOCP,可是现在已经到2.0还是没能够支持。 无意中在网上发现了个支持IOCP的libevent版本,是1.4.7版的。不过没关系,把其中的一个关键文件"win32iocp.c"拷贝到最新的1.4.14b版本中,并在"event.c" 中修改: ..... #ifdef HAVE_POLL extern const struct eventop pollops; #endif #ifdef HAVE_EPOLL extern const struct eventop epollops; #endif #ifdef HAVE_WORKING_KQUEUE extern const struct eventop kqops; #endif #ifdef HAVE_DEVPOLL extern const struct eventop devpollops; #endif #ifdef WIN32 #ifndef _EVENT_NOIOCP extern const struct eventop win32iocpops; #endif extern const struct eventop win32ops;

Libevent: multithreading to handle HTTP keep-alive connections

▼魔方 西西 提交于 2019-12-06 11:54:07
I am writing an HTTP reverse-proxy in C using Libevent and I would like to implement multithreading to make use of all available CPU cores. I had a look at this example: http://roncemer.com/software-development/multi-threaded-libevent-server-example/ In this example it appears that one thread is used for the full duration of a connection, but for HTTP 1.1 I don't think this will be the most effective solution as connections are kept alive by default after each request so that they can be reused later. I have noticed that even one browser panel can open several connections to one server and

libevent笔记3:evbuffer

廉价感情. 提交于 2019-12-05 20:44:51
evbuffer 之前提到 bufferevent 结构体提供两个缓存区用来为读写提供缓存,并自动进行IO操作。这两个缓存区是使用Libevent中的 evbuffer 实现的,同样,Libevent中也提供了相应的函数让我们能够直接操作 evbuffer 。 evbuffer的回调函数及evbuffer_cb_info结构体 我们可以为一个 evbuffer 增加回调函数,回调函数会在 evbuffer 长度有变化时被调用。 evbuffer 的回调函数列表中有一个 evbuffer_cb_info 结构体,可以用它来判断是什么事件触发了回调函数,里面包含了三个关于缓存区长度的元素: size_t orig_size: 表示长度变化前的缓存区长度; size_t n_added: 表示增加的长度; size_t n_deleted: 表示减少的长度; 读写evbuffer 除了使用 bufferevent_write 函数向缓存区读写数据外,也可以使用 evbuffer 提供的一些函数直接对缓存区进行读写操作。不过需要注意两点: 标志 EVBUFFER_FLAG_DRAINS_TO_FD 会阻止一般的读操作,只允许数据进入网络; 需要对 evbuffer 的头尾进行解冻(evbuffer_unfreeze)才能在头尾读写。不过从实验的结果来看,在调用对 evbuffer

Linux -- 消息队列 httpsqs 安装

百般思念 提交于 2019-12-05 14:44:24
安装 libevent [root @localhost httpsqs]# wget http://httpsqs.googlecode.com/files/libevent-2.0.12-stable.tar.gz [root @localhost httpsqs]# tar -zxf libevent-2.0.12-stable.tar.gz [root @localhost httpsqs]# cd libevent-2.0.12-stable [root @localhost libevent-2.0.12-stable]# ./configure --prefix=/usr/local/libevent-2.0.12-stable/ [root @localhost libevent-2.0.12-stable]# make [root@localhost libevent-2.0.12-stable]# make install [root@localhost libevent-2.0.12-stable]# cd .. 安装 tokyocabinet [root@localhost httpsqs]# wget http://httpsqs.googlecode.com/files/tokyocabinet-1.4.47.tar.gz [root@localhost

Async Redis pooling using libevent

风流意气都作罢 提交于 2019-12-05 13:32:41
I want get as much as possible from Redis + Hiredis + libevent. I'm using following code (without any checks to be short) #include <stdlib.h> #include <event2/event.h> #include <event2/http.h> #include <event2/buffer.h> #include <hiredis/hiredis.h> #include <hiredis/async.h> #include <hiredis/adapters/libevent.h> typedef struct reqData { struct evhttp_request* req; struct evbuffer* buf; } reqData; struct event_base* base; redisAsyncContext* c; void get_cb(redisAsyncContext* context, void* r, void* data) { redisReply* reply = r; struct reqData* rd = data; evbuffer_add_printf(rd->buf, "%s",

Is there a Java equivalent to libevent?

為{幸葍}努か 提交于 2019-12-05 10:38:48
I've written a high-throughput server that handles each request in its own thread. For requests coming in it is occasionally necessary to do RPCs to one or more back-ends. These back-end RPCs are handled by a separate queue and thread-pool, which provides some bounding on the number of threads created and the maximum number of connections to the back-end (it does some caching to reuse clients and save the overhead of constantly creating connections). Having done all this, though, I'm beginning to think an event-based architecture would be more efficient. In searching around I haven't found any

[Linux]centos下安装memcached

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 10:09:53
一、yum安装 1、Linux系统安装memcached,首先要先安装libevent库。 yum install libevent libevent-devel 2、安装memcached yum install memcached 二、手动安装 1.下载libevent库。 wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz 2.安装 tar -zxvf libevent-2.0.21-stable.tar.gz cd ibevent-2.0.21-stable ./configure --prefix=/usr/local/libevent-2.0.21-stable make make install 3.检查是否安装成功 ls -al /usr/local/libevent-2.0.21-stable/lib | grep libevent 4.下载memcached wget http://memcached.org/files/memcached-1.5.9.tar.gz 5.安装 tar -zxvf memcached-1.5.9.tar.gz cd memcached-1.5.9 ./configure -with-libevent=/usr/local