lua-users home
lua-l archive

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

On Mon, Mar 21, 2011 at 8:28 PM, Diego Nehab <> wrote:
> On Mon, Mar 21, 2011 at 11:23 PM, Alexander Gladysh <> wrote:
>> As long as you will provide an option to turn this off without
>> rebuilding the module — go ahead.
> You mean you can foresee a situation in which getaddrinfo would return
> an IPv6 as the preferred resolved address and yet your program would
> rather stick to the IPv4 address returned by gethostbyname, even if
> the IPv6 route connects successfully?


- when the server is broken (the OS will give it an ipv6 connection,
but it doesn't actually support ipv6)
- when the client libraries don't support ipv6 (for example, they call
getpeername(), and don't know how to handle non-ipv4 addrs)
- when you want to write a benchmark, to see if ipv4 or ipv6 is faster
- when you want to write test code for a server, and want to test
first the ipv4 and then the ipv6 (this last is our situation, we
couldn't use luasocket if it didn't allow us to choose the protocol)

OS X was enabling ipv6  for a while, and when some of the low level
resolver functions started to prefer ipv6 it caused tons of problems,
the ruby forums were full of advice on how to disable ipv6.

I'd suggest the connect() functions at least take a hint as to the
callers preference.