[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [Libevent-users] Unable to construct simple socket client with bufferevent
- To: libevent-users@xxxxxxxxxxxxx
- Subject: Re: [Libevent-users] Unable to construct simple socket client with bufferevent
- From: Nick Mathewson <nickm@xxxxxxxxxxxxx>
- Date: Wed, 31 Mar 2010 14:36:02 -0400
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: libevent-users-outgoing@xxxxxxxx
- Delivered-to: libevent-users@xxxxxxxx
- Delivery-date: Wed, 31 Mar 2010 14:36:11 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:received:message-id:subject :from:to:content-type; bh=vMU6aklYM/qh0p048d9PO84ksF1FQ9Y9H0sLKTIE76s=; b=aqrO9Zy9sLE7lEzLBH4fhtvoATJSC7rkSEG5kAeyzqD+eSgcpfJKOPtKoNWZ9pPTF/ T/oWSqlmcWjQJUSCmHaL/EPbpv5p4typFXjKvhuzXYa8Voqmp8RG/0QBBeKFKMeA7svj p+LfoIvYOrknIKVA3J7JTusLwlLLHyff/zJKw=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; b=mR6+jsgoGUxSHGMB/4XNpPjeFzRRKhi5yTkUEQSshL3IQ4Bet8BEJY4Jut/rno5zK5 j/2v7ifGDuO4Bd05bxKqC+mYB6VwiKGeFc18HvgY+lzQSIBF4shLlMz4GHSjvMirUPTR 399xuVBSFB9YWiFwYVUN1A9Yjr62WcI3ViGZY=
- In-reply-to: <4BB36FDF.4030007@xxxxxxxxx>
- References: <4BB36FDF.4030007@xxxxxxxxx>
- Reply-to: libevent-users@xxxxxxxxxxxxx
- Sender: owner-libevent-users@xxxxxxxxxxxxx
On Wed, Mar 31, 2010 at 11:53 AM, Anomit Ghosh <anomit.ghosh@xxxxxxxxx> wrote:
> I'm basically trying to a write a very simple echo server/client
> combination, just for trying out libevent. The server doesn't use
> libevent's bufferevent, but the client does.
>
> Code for server: http://codepad.org/nP0KsfPY
> Code for client: http://codepad.org/XRJAVg5m
>
> The problem seems to be that even though the connection is established
> but the server isn't receiving any data from the client and it quits.
> Where am I going wrong?
Your client is never actually entering an event loop (as by calling
event_base_loop()), so it will exit immediately. You need to call
event_base_loop at some point, or libevent will never actually try to
get and respond to events. Also, your socket needs to be nonblocking.
yrs,
--
Nick
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.