lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I am not Diego, but I think the answer to you question is
repeat the select and this will be OK.
The reason is that in both *nix and windows that select "signalling"
is reset by the read. So that sequnces like the following are OK.

do {
  select()
  read()
} while ();

So select will always tell you when there is more to read.

On 12/13/05, Edwin Eyan Moragas <haaktu@gmail.com> wrote:
> ey All,
>
> this question is supposed to be for Diego and the LuaSocket guys.
> however, it's more on the C side rather than Lua. i'm apprehensive on
> mailing Diego directly. besides, others might also be interested. here
> goes:
>
> select() accepts a two tables. one for those that can be wriiten to
> without blocking and another that can be read fronm without blocking.
> if i read from a file descriptor and my buffer isn't big enough to
> contain all that is read:
> 1.1) how will i know that there's still more to read from the file/socket?
> 1.2) do i have to read again from the file descriptor or is it safe to
> pass it back again to select?
>
> from the Luasocket reference:
> "Another important note: calling select with a server socket in the
> receive parameter before a call to accept does not guarantee accept
> will return immediately. Use the settimeout method or accept might
> block forever."
> 2.1) is this applicable to all platforms?
>
> that's it for now.
>
> salamat.
> eyan
>