How is handled in Wine?

Ben Klein shacklein at
Tue Jun 9 03:54:57 CDT 2009

2009/6/9 Kai Blin <kai.blin at>:
> It was
> annoying enough having to handle that modern linux distros always resolve the
> hostname to a loopback address and many windows apps think that
> gethostbyname(gethostname()) was a good idea to figure out what IP address to
> bind to when they actually want to bind to INADDR_ANY. (That's btw,
> and will find you my "gethostname() should not resolve to localhost" hack.)

Ah, I thought was invalid. This explains a bit.

Only case that I can think of where handling will break apps
is in lazy network programming. Consider the psuedo-code:
ip_addr = ""
for (each_ip in valid_addresses)
 if (some_test(each_ip))

On Windows, this would likely cause a catchable error. On Linux (at
least), the socket connection may succeed. I think someone said C&C3
is affected by this inconsistency between Linux and Windows INADDR_ANY
handling; this is probably why :P

Until someone demonstrates a real need for this (with appropriate test
cases) ...

More information about the wine-devel mailing list