gethostbyname(my_name) and IL2-Sturmovik

Juan Lang 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 1.0.0.127 a
> valid public IP-Adress?

Yes.

> 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.:
http://source.winehq.org/source/dlls/iphlpapi/ifenum.c#L201

Or, as I suggested before, you could call iphlpapi.GetAdaptersInfo: it
already excludes local interfaces, and winsock already depends on
iphlpapi.

--Juan

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the wine-devel mailing list