hi Rein,
On my system everything works as expected: I get a list of all ip addresses. That is with valid /etc/hostname and /etc/hosts entries.
That's the trouble. Not every *nux box has the correct results - some do (like yours) - in fact I'd say many do not. We have done many Linux and Lindows installs, and none of them had the correct settings in /etc/hostname and /etc/hosts by default, except one. Incomplete install/configuration or not, the trouble is that windows guarantees this behaviour and *nix does not. In the real world, the results are lucky at best we get the correct results. Those who have tried our product offsite running under WINE run into the same issue - over and over, the results from gethostname passed into gethostbyname do not work as it does under windows all of the time. Worse, they sometimes return the external IP instead of internal IP addresses. Since we are a windows app - we can't adjust ourselves to bogus set up /etc/hostname configurations since we have no specific knowledge we are running under a *nix flavour (as we should not). In order to be compatible, you MUST guarantee the results from passing NULL or gethostbyname return a list of local IPs using a different method than /etc/hostname and /etc/hosts which isn't working right on all *nix machines. Seems that most people with external IPs had the correct results, but most people with internal IPs did not. This isn't always the case, but seems to be a common theme.
-Rob