[Gambas-devel] Gambas DNS resolution working in Windows, patch, new screenshot

Daniel Campos daniel.campos at ...103...
Wed Feb 16 00:08:58 CET 2005


>
> Daniel: Why are you using reentrant functions inside a semaphore? 
> Isn't it safe to use the non-reentrant ones there?


No, I tried that, but I was unable to use gethostbyname() because once 
the object try to kill the thread (for example if the user cancels the 
operation), the dns query never works again until the program is closed 
and restarted. that is the reason of the gethostbyname_r existence.

> I can't use gethostbyname_r or gethostbyaddr_r on Cygwin. They don't 
> exist and are nonportable. I didn't have any crashes with this patch, 
> but it's a lazy hack.  Do you have a better idea how to handle this?
>
> (BTW, there's a PD implementation of gethostbyname_r at
> http://www.cygwin.com/ml/cygwin/2004-04/msg00532.html
> )

Mmmhh... well I don't know very much about Cygwin... may be it is 
possible to use the Win$ native functions to
implement it? I think these functions are asynchronous ( I had to use 
them, a lot of time ago, for a
Windows program)

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/wsaasyncgethostbyname_2.asp

>
> Shouldn't we be using getaddrinfo and getnameinfo instead? Or are 
> those too new to be implemented everywhere?


Well, gethostbyname_r works OK for Linux systems, so I won't change that 
implementation, however if Cygwin
can use getaddrinfo and getnameinfo, I can try to write a #ifdef 
CYGWIN... patch

Regards,

D. Campos





More information about the Devel mailing list