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
0 answers

Is it safe to store pointers to bufferevents?

I am working on a daemon, in C using libevent library, which accepts TCP connections and creates bufferevent (socket) for each accepted connection as following struct bufferevent *bev = bufferevent_socket_new( base, sfd, …
fade2black
  • 546
  • 1
  • 10
  • 26
0
votes
1 answer

can I use curl_multi/multi_socket with libevent

I'm using libevent2 for building a server, and I'm trying to enable the server to use libcurl asynchronously, and I'm wondering about how I do that with libevent2. I would like to be able to get curl to send events so I can inspect the current…
MathGladiator
  • 1,201
  • 1
  • 10
  • 24
0
votes
0 answers

Can I replace libcurl with libevent for file download only

I am new to libevent and experimenting some stuff here. I am given a URL of a file, I need to download this file using URL. can I perform this task using libevent in anyway ? I am able to perform above task using libcurl. But interested to know if…
0
votes
0 answers

How to call bufferevent_write several times?

I am a newbie in libevent, my program below is quite simple. I want to call bubufferevent_write several times, but is seems that it works only for the 1st time. int main(int argc, char const *argv[]) { struct sockaddr_in serv_addr; struct…
HuangJie
  • 1,488
  • 1
  • 16
  • 33
0
votes
1 answer

python socket handle keepalive request

I am using python to write a simple web server, and sending requests to it. And I use libevent as my http client. But every time I send a keep-alive request, the http connection have the close callback before the success callback. I think it might…
Xiaoying Wang
  • 329
  • 4
  • 9
0
votes
1 answer

What is the implementation detail of libevent? An encapsulation of poll mechanism?

libevent provides programmers the ability to write asynchronous programs due to the event notifications and callback function supports. I don't know if the linux kernel provides such system calls to notify user space applications when a particular…
Douglas Su
  • 3,214
  • 7
  • 29
  • 58
0
votes
1 answer

Multiple libevent bases in different threads on the same fd

I'm curious to know if anyone else has tried this... I'm about to give it a go, but was hoping someone else may have some experience to share before I sit here at 11:00 pm (having to go to work in the morning) to try this. If I load up a few…
0
votes
1 answer

adding timer events with event_base_loop

my ebase thread perform the following loop constexpr int kFlag = EVLOOP_ONCE; while ((res = event_base_loop(ebase_, kFlag)) == 1) { yield(); } and the other (main) thread adds periodic timer event. It adds the event after the ebase…
Roman
  • 1,351
  • 11
  • 26
0
votes
1 answer

how to properly deal with send/write with a non-blocking socket?

I have a socket which is used to receive and also send packets. And the pseudo codes are: setnonblock(fd); add_event(event_base, recv_ev); while("I have packets to write"){ send(fd, packet); .... } .... now the issue is,…
lily
  • 515
  • 7
  • 20
0
votes
1 answer

My libevent timer stops as soon as another event occurs... is that normal?

Currently I setup two events: Listen for new connections from clients (I'm a server) A timer to run some code once a second to do various background work On startup the timer works and I can wait as long as I want and my callback gets called over…
Alexis Wilke
  • 19,179
  • 10
  • 84
  • 156
0
votes
1 answer

the callback passed to evhttp_request_new might get NULL

The following function is a callback passed to evhttp_request_new(). My code sometime abort because of assert fail. I am confusing that what may cause the pointer req to get NULL? void http_request_done(struct evhttp_request *req, void *arg) { …
0
votes
1 answer

php libevent is multithreaded?

I have wrote simple server on php and libevent.
Max P.
  • 5,579
  • 2
  • 13
  • 32
0
votes
1 answer

libevent problems with linking on ubuntu server 14.04

I have problem with linking libevent into my c project on ubuntu 14.04 LTS Server. Everything works fine on ArchLinux and Centos7 (both ubuntu and centos I run on virtual machine). These is my Makefile: TARGET: opoznienia CFLAGS = -Wall -O2…
0
votes
1 answer

Protobuf and Non-blocking message send/recv

I am developing my message passing interface using protobuf and non-blocking libevent socket libraries. Because of the non-blocking properties, the read callback by libevent might be invoked at some points where the messages are not complete (e.g.,…
Jes
  • 2,614
  • 4
  • 25
  • 45
0
votes
1 answer

File descriptor does write data in C

I am using the joyent http-parser and lib event to create my own simple web server in C. I have it connecting to the port and receiving the HTTP requests fine, however, I am not able to send a response using the socket. So in one window I enter: $…
jnd
  • 754
  • 9
  • 20