[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Line-based evbuffer?



On Tue, Feb 2, 2016 at 1:50 PM, Ãystein SchÃnning-Johansen
<oysteijo@xxxxxxxxx> wrote:
> Thanks, I'm aware of that function. However, the reads from the socket comes
> in with several lines at a time and the buffer does not necessarily begin
> with the start of a new line or end at the end of a line. In these cases the

Even if it will end with new line, no guarantee that you will receive
this like the sender send, since this is network and you have
non-blocking IO.

> callback handler will handle the last full line first. I'm not sure if this
> is a bug in evbuffer_readln() or not?

I'm not sure that I understand you, it can't work like this,
it must process buffer from begin->end not in the reverse order.

Can you please provide a sample, that will show this behavior?

And of course evbuffer have buffering, IOW if you have something like this:
recv(4, "foo")
recv(4, "bar\n")

Then evbuffer_readln() will return "foobar\n", and will return empty
if you will call it between this two recv().

Am I missing something?
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.