2009/6/9 Kai Blin kai.blin@gmail.com:
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 0.0.0.0 btw, and will find you my "gethostname() should not resolve to localhost" hack.)
Ah, I thought 0.0.0.0 was invalid. This explains a bit.
Only case that I can think of where 0.0.0.0 handling will break apps is in lazy network programming. Consider the psuedo-code: ip_addr = "0.0.0.0" for (each_ip in valid_addresses) if (some_test(each_ip)) ip_addr=each_ip socket=connect_to(ip_addr)
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) ...