Questions tagged [libevent]

libevent is an API for writing event driven systems. libevent is written in C and should compile on Linux, *BSD, Mac OS X, Solaris and Windows.

From the Homepage: Libevent

libevent is meant to replace the event loop found in event driven network servers. An application just needs to call event_dispatch() and then add or remove events dynamically without having to change the event loop.

Currently, libevent supports /dev/poll, kqueue(2), event ports, select(2), poll(2) and epoll(4). The internal event mechanism is completely independent of the exposed event API, and a simple update of libevent can provide new functionality without having to redesign the applications. As a result, Libevent allows for portable application development and provides the most scalable event notification mechanism available on an operating system. Libevent can also be used for multi-threaded applications; see Steven Grimm's explanation. Libevent should compile on Linux, *BSD, Mac OS X, Solaris and Windows.

368 questions
0
votes
1 answer

Libevent 2 - write callback / infinite loop

I'm playing with Libevent as a server and I'm having a problem Basically I'm using the example at the bottom of this page, http://www.wangafu.net/~nickm/libevent-book/Ref6_bufferevent.html: I have the main/accept/readcb working well - however…
0
votes
1 answer

libevent2 http not detecting client network broken

I am not pasting the source code here, if any one whats to reproduce the problem, download the code from this github project: It is a Comet server, the server use libevent-2.0.21-stable http. To reproduce the problem: start the icomet-server from…
ideawu
  • 2,287
  • 1
  • 23
  • 28
0
votes
1 answer

Libevent, add or remove events dynamically without having to change the event loop

I'm facing a problem that may be a misunderstanding of what this sentence really means "An application just needs to call event_dispatch() and then add or remove events dynamically without having to change the event loop." or I can't find the right…
vicaba
  • 2,836
  • 1
  • 27
  • 45
0
votes
0 answers

syslog-ng : accept using same fd before former connection close (then open fd reaches the limit)

My program use a main thread accept comming connections(so there is no accept racing!),then give it to 4 slave threads ,they will close when r/w return 0. but some times the log print like this..... Feb 27 00:13:31 mx59 lp_server.c[62]…
aishuishou
  • 83
  • 7
0
votes
2 answers

a stack overflow (about "evhttp_uri_parse")

code realize function that reading file(contain lots of urls) ,every url pass through "evhttp_uri_parse" getting host and path.But it has a error that evhttp_uri_parse parse fail ,return NULL。Possibly reason is a stack overflow. FILE…
sanwuhai
  • 1
  • 2
0
votes
1 answer

read event never triggered, using libevent

I just write an echo server using libevent, but it seems that the read event is never triggered. The code is: #include #include #include #include #include #include #include…
aishuishou
  • 83
  • 7
0
votes
0 answers

libevent multithread http server

i have such problem. I need to write multithread http server using libevent, but don't using . So i have problems with handle request. So i have int main() { .............. /*Some standard stuff for binding to port*/ …
Mike Minaev
  • 1,912
  • 4
  • 23
  • 33
0
votes
1 answer

libevent-2.1.4-alpha, server can't receive connection event when initialized with IOCP enabled

I use libevent-2.1.4-alpha, server can't receive connection event when initialized with IOCP enabled. int main(int argc, char **argv) { struct event_config *evcfg; struct event_base *base; struct evconnlistener *listener; struct sockaddr_in…
jie xu
  • 1
  • 1
0
votes
2 answers

Chunked responses in libevent2

I am trying to do a chunked response (of large files) in libevent this way:: evhttp_send_reply_start(request, HTTP_OK, "OK"); int fd = open("filename", O_RDONLY); size_t fileSize = ; struct evbuffer *databuff = NULL; for (off_t…
Sri
  • 1
  • 1
0
votes
1 answer

link error when compile a libevent based C code

Got a sample program (from https://raw.githubusercontent.com/libevent/libevent/master/sample/https-client.c) that uses libevent to simulate HTTPS client. I saved it to te1.c and compiled it, but got the following link error. $ gcc -g te1.c -levent…
0
votes
1 answer

How to use libevent to detect when file lock is released?

While using libevent for detecting read/write readiness of non-blocking disk file descriptors (for files gaurded by mandatory locking), I faced the following issue: When a file is locked for IO by another process, I get EAGAIN in current process…
skaur
  • 168
  • 2
  • 11
0
votes
1 answer

porting epoll to libevent

I developed a server using epoll. It works fine under Linux. But I want to give macosx support using kqueue. I heard that libevent is a abstraction layer on top of these event based libraries(epoll, kqueue). How can i port this code using epoll to…
yet
  • 773
  • 11
  • 19
0
votes
1 answer

Getting error Warning: Could not link libevent. Unlinking

Trying to install tmux on OSX but getting: $ brew install tmux Error: You must `brew link libevent' before tmux can mdurrant@C02MH2DQFD58:~ $ brew link libevent Linking /usr/local/Cellar/libevent/2.0.21... Warning: Could not link libevent.…
Michael Durrant
  • 93,410
  • 97
  • 333
  • 497
0
votes
1 answer

golang cgo: libevent handler values are set to null during execution

i'm working on porting this C API in go https://github.com/shammash/vde3, the library has is own event loop that use libevent, i'm using CGO. the library require a full vde_event_handler that is composed this way {event_add = 0x7fffe4de0db0,…
kurojishi
  • 321
  • 1
  • 4
  • 12
0
votes
3 answers

How to link an included library in C?

I have been trying to use an included libevent in a program, however I have been receiving the error. gcc lumberd.c Network.c ../Config.c -o lumberd.x Undefined symbols for architecture x86_64: "_event_base_new", referenced from: _main in…
stmfunk
  • 663
  • 5
  • 20