[Gambas-devel] DnsClient patch
Brandon Bergren
bdragon at ...185...
Thu Feb 17 01:23:38 CET 2005
On Thu, 17 Feb 2005, Daniel Campos wrote:
> Hi:
>
> Well, It was easier than expected, at the end I remembered all that I did in
> the
> DnsClient class :-))
>
> Here's the implementation of DnsClient using getaddrinfo and getnameinfo,
> that
> should replace the current one. According with SUN documents, this should
> also
> work for Solaris, however the old code for Solaris is still in the file
> (commented)
> as I can not test it.
>
> This version should compile also with Cygwin, I think... Brandon?
>
> Regards,
>
> D. Campos
>
Aw hell. Is my face red... Cygwin doesn't actually HAVE getaddrinfo and
gethostinfo by default. (Compatibility with Win9x, etc)
IPV6 in Cygwin only works on WinXP and is alpha :(
http://win6.jp/Cygwin/
I should have looked at my own netdb.h before saying how great get*info
is....
I guess there's no way to get around not using #ifdefs in network code :(
Cygwin's gethostbyname and getaddrbyname appears to be safe between
threads if you put it in a mutex lock while running the function and
copying data out of the returned struct.
Is the point of Async vs Sync just whether to block or not? Or is it
supposed to be able to run multiple resolves at once?
I don't see any way to do the latter cleanly on Windows right now. :(
BTW, on line 178, does that make a thread block if another thread got to
the semaphore first? I don't know too much about multithreaded
programming yet... Still a little confused about locking...
--Brandon
More information about the Devel
mailing list