[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[Libevent-users] Need help with server
- To: libevent-users@xxxxxxxx
- Subject: [Libevent-users] Need help with server
- From: Dm <russiankickingbear@xxxxxxxxx>
- Date: Tue, 08 Oct 2013 15:19:47 +0400
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: libevent-users-outgoing@xxxxxxxx
- Delivered-to: libevent-users@xxxxxxxx
- Delivery-date: Tue, 08 Oct 2013 07:18:30 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=OaI+Wfq9opL/JFMInurfo4Fczj/3bDxnmz2LeVGMaik=; b=i0/h1WFaJOiGo4RHA/ughBj1i5YQpWeYNj9dkaNtOtUR8m4j/xXJzx+5EUEQCxEoTd 5IK3ViO5L04p7G9/5Y7wH6Wlu2FH1bakMZQL8Uc64/PRZX6/rt+Lh70D/tkXK2kpq5oT 09BLG1NVcoY+EZAQAIFN9Fw9nkb5cXB8PyRYp7wvoAcH6ivPL/5gBJx3fRC/V7E/vx+G hb29cr13IID/EdtCoDXLVOkIxK6DKtZ6ypZpeIFL9/fCGFtE2hsvijwC7yFqAJublXLB 8rvt3rFlHqZlGmA+HAPJz5A4sBvyLR7DjbbbPZ2uDvgeph++VhQ4lI5jMg5dCU5mASK0 gBAw==
- Reply-to: libevent-users@xxxxxxxxxxxxx
- Sender: owner-libevent-users@xxxxxxxxxxxxx
- User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8
Hi to all.
I tryed to write server with handling events with using
event_base_dispatch() in one case and event_base_loop() in another.
In first case event_base_dispatch() called by main thread and in another
thread's i process received events (associated with connected clients)
with some server logic and send response to client by
bufferevent_write(). When all client's disconnect event_base_dispatch()
returned. Ok, this case described in documentation.
But i want save server alive state.
And than i try second case: call event_base_loop() in somth like
while(_work) cycle. It's calling, all right, but new events (after
client's disconnect) not registered.
I mean, no new callbacks are not called, but client try to connect with
server. OK , let's google it.
Last case: use libevent-2.1.3-alpha's function event_base_loop() with
flag EVLOOP_NO_EXIT_ON_EMPTY. Nice, server started to work as i want.
But. Client don't receive data from server.
I used tcp sniffer, and saw how data transfered in socket, but client
(with event_base_loop() realization) not received data (no callback).
Maybe there is some best practice with libevent to create tcp-server? I
googled, but most simple realization used event_base_dispatch(), which
returned, when last client disconnected.
Would be very grateful for the help
Dmitry.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.