lua-users home
lua-l archive

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


On Sat, May 30, 2009 at 2:13 AM, Diego Nehab <diego@tecgraf.puc-rio.br> wrote:
> Hi,
>
>>> I would like something like:
>>> socket.connect(..., cb_function)
>>> Where cb_function receives the connection or nil when failing.
>>
>> Doing socket.tcp(), setting it to non-blocking, then call connect(),
>> then selecting on it should work if I recall correctly.
>
> Yes. Select for writing. When select returns, call connect again on the
> socket to see if the connection succeeded. It should return the error
> "already connected".
>

It seems to me that connect() can block (30 seconds in my case) when
the DNS server for the domain is unreachable. I only discovered this
the other day and haven't managed to confirm the finding yet. If it's
true then it seems I need to switch DNS lookups for A records also to
our async DNS library...

Matthew