lua-users home
lua-l archive

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



My problem is that a timeout resolution of a 1 second is way too coarse.
It would mean that if there was no data available to receive, the
simulator would stop for a full second after every simulation frame.

Luasocket's timeout is a Lua number, i.e. a double/float. So, you can use smaller values than 1.

Is there are a way to configure select() turn return _instantly_ if there
is no data available?

Yes, use a zero timeout value.

In the description for settimeout() there is this :

"Note: although timeout values have millisecond precision in
LuaSocket,..."

Does this mean that settimeout() will accept fractional second values
such as settimeout(.10) as being valid for a 1/10th of a second timeout?

Yes. Why don't you simply try it out? The timeout mechanism has been part of Luasocket for quite a while now... And it works splendidly.

Ashwin.
--
no signature is a signature