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 with non blocking sockets: If the remote peer sends RST *while* send on local is executed, will local get EV_READ also

From the libevent documentation, I understand that when a TCP segment is received from the remote peer, an EV_READ event is generated. What happens in the following scenario Non blocking application having registered for both read and write events…
doon
  • 2,311
  • 7
  • 31
  • 52
0
votes
2 answers

how to covert dynamic linking to static linking

I have a program which use libevent library when compile the program, the compiling command is like: gcc -o myprogram mysource.c mysource.h -levent so it is dynamic linking. now I want to run this program on a computer where there is no…
misteryes
  • 2,167
  • 4
  • 32
  • 58
0
votes
1 answer

How do the async file IO methods work for local files in Node.js?

Node has a async/sync versions of all its filesystem IO operations, but I was wondering: how is async file IO implemented in Node.js for operations on local files? I myself was messing around with libevent, which uses the reactor pattern, like Node,…
Alexis King
  • 43,109
  • 15
  • 131
  • 205
0
votes
1 answer

how to search and delete an event in programs using libevent library?

in my program I add an event as below: conn_ev = (struct event *)malloc(sizeof(struct event)); event_set(conn_ev, connfd, EV_READ, on_recv, conn_ev); event_base_set(base, conn_ev); if(event_add(conn_ev, NULL) == -1){ …
misteryes
  • 2,167
  • 4
  • 32
  • 58
0
votes
1 answer

can libevent `struct event` variable be modified?

in on callback function on_accept, I make a event conn_ev conn_ev = (struct event *)malloc(sizeof(struct event)); event_set(conn_ev, connfd, EV_READ, on_recv, conn_ev); event_base_set(base, conn_ev); event_add(conn_ev, NULL); the…
misteryes
  • 2,167
  • 4
  • 32
  • 58
0
votes
2 answers

error while loading shared libraries, installation misplaced `.so` files in /usr/lib

I'm using libevent in my source code, after compiling the program, I run it and I got the following error: ./my_program: error while loading shared libraries: libevent-1.4.so.2: cannot open shared previously I was at a loss on how to instal…
user138126
  • 953
  • 3
  • 14
  • 29
0
votes
1 answer

Libevent use too much CPU

Recently I write a simple example using libevent, #include #include #include #include #include #include #include #include
0
votes
2 answers

Monitoring a set of directories and generating "events", when new files appear - can libevent or libev do that?

I'm writing a program in PHP (don't ask), which needs to monitor a set of directories waiting for files to appear and processing newcomers. Can libevent or libev (both have matching PHP-extensions) generate such events? I know, the underlying…
Mikhail T.
  • 3,043
  • 3
  • 29
  • 46
0
votes
1 answer

libevent cannot read an open socket descriptor

recently, I have a small socket server program using libevent. In summary, it does following job. void read_function(int fd, short event, void* arg) { printf("callback is called!\n"); // read from fd, and send a reply to fd! } void…
Byungjoon Lee
  • 913
  • 6
  • 18
0
votes
3 answers

Unable to install libevent-devel

I'm trying to install libevent-devel but it failed due to dependencies which shown below. I tried also to install the dependencies needed by libevent-devel but it also failed as its needs the libevent-devel as shown below. How can I resolved this…
cutejakes .
  • 111
  • 1
  • 2
  • 6
0
votes
1 answer

Using EVLOOP_NONBLOCK in libevent

In libevent I've added the following code: while (run) { event_base_loop(base, EVLOOP_NONBLOCK | EVLOOP_ONCE); } If I compare this to the following: event_base_dispatch(base); Are these two statements equal?
name5566
  • 91
  • 2
  • 5
0
votes
1 answer

Installing Event::Lib in CitrusPerl install on Mac OS X 10.7

I'm working on a Perl project that requires Event::Lib. I'm on MacOS 10.7, and am running Citrus Perl instead of the system Perl. I installed libevent from source and it compiled fine. But, when I go to install Event::Lib, I run into some…
coding_hero
  • 1,759
  • 3
  • 19
  • 34
0
votes
1 answer

evhttp_request_new() evhttp_request return null

I write a libevet program to get data from some web interface. the code like this: sometimes the struct evhttp_request *req of self->done is NULL. I cannot find why of this . response->connecttime = spi_utils_float_time(); self->evreq =…
chjuheng
  • 21
  • 4
0
votes
1 answer

Why is it evbuffer_add_printf will only accept static variables and not "dynamic" ones?

So far I have gotten my libev code to successfully return a static sting that says "OMP OMP", however when I write a function that returns a "static" string it never seems to work. (Sidenote: the idea is to turn that same function into a dynamic…
Xenland
  • 510
  • 1
  • 6
  • 19
0
votes
2 answers

Get libev remote ip address from this example code?

I'm trying to learn libevent/libev (in this case its libev) from the following link: http://www.ibm.com/developerworks/aix/library/au-libev/ I'm wondering how to find out what the remote ip address is so I can build my own DHT. I'm guessing it has…
Xenland
  • 510
  • 1
  • 6
  • 19