lua-users home
lua-l archive

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


Hi,

Yes, the DNS lookup can do that. What does an async DNS
library look like?

It's a non-blocking wrapper[1] around a fixed and hacked up version[2]
of dns.lua[3]. A nice C replacement regularly features in our
dreams[4] :)

The catch is that we need to look up SRV records and need a reasonable
timeout, which the standard Linux resolver doesn't appear capable of.

So there is a Lua implementation of gethostbyname that does
not block?

It seems as though you should have no
trouble replacing the DNS lookup in LuaSocket with something
else, without any changes to C code.


Oh so the DNS lookup is performed from inside LuaSocket? That greatly
simplifies things, thanks.

I don't know what you mean by the question. LuaSocket has
two DNS facilities. One is when you invoke
socket.dns.toip(). The other is when you invoke connect()
with a domain name. Both cases and up invoking
gethostbyname.

What I meant is that if you have a Lua replacement of
gethostbyname, you can do your own translation and pass the
ip as a string to the non-blocking connect().

Regards,
Diego