Re: Can there be a better way of doing non-blocking data reads with LuaSocket?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Can there be a better way of doing non-blocking data reads with LuaSocket?
- From: Diego Nehab <diego@...>
- Date: 2008年11月12日 03:50:58 -0500 (EST)
Hi,
I wasn't too worried about that. I'm not really sure what the use case
for that parameter is, generally, but I particularly can't see why
you'd want a prefix inserted into essentially random spots in a TCP
stream!
Think about reading a line pattern in non-blocking mode,
i.e., with 0 timeout. You don't know if the line will come
in one function call or if it will be split into several
function calls. You don't know if it will fit in the buffer
or not, so you can't accumulate it there. So passing the
partial result from the previous call into the next call
makes sure that when the call finally succeeds, you have
your entire line in one place. I think it is pretty
convenient. If there is a bug on this idea, let me know and
I will fix it.
Regards,
Diego