lua-users home
lua-l archive

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


I use COPAS with luasocket which allows async connect. But would need a non-blocking DNS lookup if you want complete async as DNS lookup using the underlying library can be a blocking call. luasocket supports async connect if you setup the timeout to be 0 if I remember correctly.

--- On Sat, 5/30/09, Francisco Sant'anna <francisco.santanna@gmail.com> wrote:

> From: Francisco Sant'anna <francisco.santanna@gmail.com>
> Subject: LuaSocket - non-blocking connect ?
> To: "Lua list" <lua@bazar2.conectiva.com.br>
> Date: Saturday, May 30, 2009, 5:41 AM
> Is it possible?
> 
> If I'm not missing something, a call to socket.connect
> will block the application until the connection is ok (or
> fail).
> The problem is that I want to use LuaSocket in an
> event-driven system -- such connect call inside a callback
> would freeze the whole system.
> 
> I would like something like:
> socket.connect(..., cb_function)
> Where cb_function receives the connection or nil when
> failing.
> 
> Thanks.
> 
> 
>