On Wed, Nov 19, 2014 at 03:52:37PM +0200, Vlad Khorsun wrote: > 19.11.2014 13:52, Michal Kubecek wrote: > > Could you please try attached patch? It uses AF_UNSPEC in getaddrinfo() > > hints whenever host string is non-empty and retries getaddrinfo() with > > AF_UNSPEC if AF_INET6 fails for empty host string. > > It doesn't look at error codes and tries to guess what happens. For > example, if first call of getaddrinfo() returns error because of > wrong service name, code will change ai_family without a reason to > do it. Second call will fail too (because reason was not fixed). > Third call with fixed service name will succeed but with AF_UNSPEC > in ai_family. Is it how it supposed to work ?
Could you check if first getaddrinfo() call returns EAI_FAMILY on Windows XP without IPv6 support? The way I read the manual page it should but I would rather make sure. > > Handling Windows XP with IPv6 support will be more tricky. What might > > work would be to move the attempt to set IPV6_V6ONLY earlier, before > > getaddrinfo() is called, and also use AF_UNSPEC if setting IPV6_V6ONLY > > to 0 failed. > > You assume that IPv6 support is more important than IPv4. Why ? No, I don't. The reason for AF_INET6 is that a PF_INET6 socket bound to :: can accept both IPv6 and IPv4 connections (as long as IPV6_V6ONLY is 0 and the system supports this setting) while a PF_INET socket can only accept IPv4 connections. Therefore PF_INET6 should be preferred if we want to listen on "any address" (as long as we can only use one socket). Michal Kubecek ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel