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

Libevent - causes an error at the very start

Please tell me: I connected the libvent to the project for Windows VS2019 and called only one function Libevent: #include #include #include int main(void) { struct event_base*…
Optimus1
  • 444
  • 2
  • 13
0
votes
1 answer

How to generate a PKG CONFIG file when building libevent from source?

I'm building libevent from source with the following set of commands on Linux. export LDFLAGS="-march=x86-64 -L/home/me/locals/lib64/zlib-1.2.11-gcc-9.3.0/lib" export CPPFLAGS="-march=x86-64…
mbilyanov
  • 2,315
  • 4
  • 29
  • 49
0
votes
1 answer

Install libevent man pages from sourcecode with autotools

I've installed libevent from source code (from the git repository) with autotools. I thought the command 'make install-man' would install the man pages, but nothing is available. I've also tried setting the './configuration --datadir' option without…
fifoq
  • 183
  • 13
0
votes
1 answer

Is bufferevent_flush not necessary for a socket-based bufferevent in libevent?

From the documentation of libevent: Currently (as of Libevent 2.0.5-beta), bufferevent_flush() is only implemented for some bufferevent types. In particular, socket-based bufferevents don’t have it. I tested the following code: auto output =…
xmllmx
  • 39,765
  • 26
  • 162
  • 323
0
votes
0 answers

unable to compile thrift with mingw and libevent

I'm trying to compile the thrift cpp library from a debian and mingw toolset. I manage to compile zlib, openssl, and libevent with mingw. But when I'm trying to configure thrift, it does not detect libevent (but it detects openssl and zlib). below…
0
votes
1 answer

Hiredis publisher only sending first message in a while loop

I am quite new to Hiredis/Redis and can't manage to create a working publisher in a while loop for a Pub/Sub architecture. I succeeded in creating a publisher firing only one message, then exiting. But I'm trying to have a publisher sending messages…
RobBlanchard
  • 855
  • 3
  • 17
0
votes
0 answers

libevent stops working after a few thousand calls

Below is my initialization code from the main() evthread_use_pthreads(); struct event_config *cfg = event_config_new(); event_config_require_features(cfg, EV_FEATURE_EARLY_CLOSE); c->base =…
Jim
  • 338
  • 1
  • 14
0
votes
0 answers

Best way to "communicate" between sockets

Curently I`m developing chat aplication using C and libevent library for both client and server. I started from simple prototype, where client simply send plain string, server recive it and send it to every connected user except the sender. But now…
0
votes
1 answer

unexpected socket closure on server side

I am running a sample libevent based server, however, sometimes, this server will immediately send a TCP FIN immediately after TCP handshake according to wireshark capture. The server didn't crash. The OS is ubuntu 18.04, the terminal has ulimit -n…
packetie
  • 4,839
  • 8
  • 37
  • 72
0
votes
0 answers

Libcurl multi with libevent: How to support single curl_easy timeout mechanism?

I've implemented multi example with libevent (multi-event) Additionally I add curl_easy_setopt(curl_easy, CURLOPT_TIMEOUT_MS, 10000); on_timeout do callback when after 10000ms, but I need the exactlly curl_easy obj which curl_easy_setopt…
Qilin Li
  • 25
  • 5
0
votes
0 answers

Libevent buffer truncated after read callback. How to retrieve large data from buffer

Using libevent 2.1.11, reading the input evbuffer is limited to 4096 bytes. Due to EVBUFFER_MAX_READ 4096 in buffer.c Given this information, the next read callback should be called after the first read callback with the remaining data. Running this…
reeves
  • 173
  • 1
  • 1
  • 11
0
votes
3 answers

Know of any small projects implementing an HTTP service using libevent?

My C is a bit rusty. I have some ideas I'd like to try and realize with libevent. Do you know any codebase I can use as a reference?
Vasil
  • 36,468
  • 26
  • 90
  • 114
0
votes
1 answer

Broadcast TCP-Server with libevent

I am looking for some sample code of a dead simple libevent-based TCP-Server which broadcasts incoming Messages to all connected clients. On the Web I only found TCP-Servers which echoes back messages. One echo example if found is on the bottom of…
Filipe Santos
  • 1,629
  • 3
  • 18
  • 27
0
votes
1 answer

Linker errors when linking a built libevent as a static library, but works when linking as a shared library

I've built the libevent library from source as static library using GCC compiler(on linux). Cmake options: cmake -B build -S . -DEVENT__DISABLE_OPENSSL=ON -DEVENT__LIBRARY_TYPE=STATIC -DEVENT__DISABLE_DEBUG_MODE=ON cmake --build build --config…
georg774
  • 15
  • 3
0
votes
1 answer

How to improve libevent bufferevent_write performance

For my test case, only send "00" message by bufferevent_write. case 1: 20,000 tcp connections, and send "00" to each every 10s, it will cost 0.15s. case 2: only 1 tcp connection, and send "00" 20,000 times every 10s, it will cost 0.015s. Please give…
DinoStray
  • 696
  • 1
  • 6
  • 20