>On Sat, Apr 14, 2012 at 4:15 AM, Dawen Rie <
dawenhing@xxxxxxx> wrote:
>> Hello everybody. I am a new user of libevent. I can't find the correct
>>API
>> to do my work.
>> I had found the API:
>>
>> int bufferevent_write_buffer(struct bufferevent *bufev, struct evbuffer
>> *buf);
>> It will send all data of evbuffer. But I just want to send a special
>> length not all.
>>
>> And API:
>> int bufferevent_write(struct bufferevent *bufev, const void *data,
>>size_t
>> size);
>>
>>
>> It require me copy out the data from evbuffer, I think it's
>>inefficiency.
>>
>> So, is there andy API like:
>> int bufferevent_write_buffer(struct bufferevent *bufev, struct evbuffer
>> *buf, size_t size);
>>
>> It just send size of data in but?
>
>Hi!
>
>What you want to be looking at first is bufferevent_get_output(). It
>returns an output evbuffer that you can add data to manually. The
>bufferevent_write() and bufferevent_write_buffer() functions are thin
>wrappers around bufferevent_get_output() and one of the evbuffer_*
>functions.
>
>So now the question becomes, "how can I add move (but not all) of the
>data from one evbuffer to another?"
>
>For that, see evbuffer_remove_buffer().
>
>For more information, you might want to read the (perpetually
>work-in-progress) reference manual at
>
http://www.wangafu.net/~nickm/libevent-book/
>
>yrs,
>--
>Nick
>***********************************************************************
>To unsubscribe, send an e-mail to
majordomo@xxxxxxxxxxxxx with
>unsubscribe libevent-users in the body.
***********************************************************************
To unsubscribe, send an e-mail to
majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.