gethostbyname(my_name) and IL2-Sturmovik
juan_lang at yahoo.com
Wed Dec 14 14:11:50 CST 2005
> Since you're concerned about the performance, which is valid, I've also
> removed all the string-conversions. Important question: Is 126.96.36.199 a
> valid public IP-Adress?
> If yes, I'd have to furtherly change the code, adding some
> htonl, ntohl, or similar.
Yes, and that would allow you to do only one comparison.
> + BOOL get_public_ip(DWORD* target)
This still needs to be static. (static BOOL get_public_ip...)
> + for (i = 0; i < ifc.ifc_len / sizeof(struct ifreq); i++)
Now I remember why I was concerned about this. This isn't portable. In
some systems, struct if_req occupies fixed space in ifc, but in others,
the size depends on the amount of data in each struct if_req. You need to
use ifreq_len. See e.g.:
Or, as I suggested before, you could call iphlpapi.GetAdaptersInfo: it
already excludes local interfaces, and winsock already depends on
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
More information about the wine-devel