lua-users home
lua-l archive

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

> > select() accepts a two tables. one for those that can be wriiten to
> > without blocking and another that can be read fronm without blocking.
> You shouldn't think about it like this.  Unless you put your socket in
> non-blocking mode, you will end up blocked. One day you will ask for one
> extra byte and block, or try to write one extra byte and block. So the
> idea is to place the sockets in non-blocking mode, use select to block
> you until something interesting happens, and then try to read or write.
> If it fails with timeout, you call select again to block until something
> interesting happens. Then you just try again. Select allows you to avoid
> a busy wait, got it?

i got this one.

 the premise i was working on was wrong. it should be after calling select,
i should have some set of descriptors which are readable and/or writeable,
if there are any.

thank you.