lua-users home
lua-l archive

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


Hi,

Anyhow, if connect fails (or any other asynchronous error
occurs on a socket, such as a connected socket getting
closed), select will return it as either readable,
writeable, or both (which you can see below, I'm on a
linux box).

Then, when you attempt to use the socket, the call will
return an error.

Thanks Sam. I just moved to a new house and didn't have
Internet until today. Anyway, there is a file dispatch.lua
in the LuaSocket distribution that uses a non-blocking
connect.

I think that what I do is call connect. It will return
"timeout" if connection is in progress. The socket will select writeable once the result of connect arrives. Then you call
connect again and it will either work immediately or it will
report an error with "alraedy connected". If it says
"timeout" again, you know it really timedout.

Regards,
Diego