Socket timeout not working with libUrl

Dave Cragg dcragg at lacscentre.co.uk
Tue Feb 1 03:36:52 EST 2005


On 1 Feb 2005, at 01:33, Sarah Reichelt wrote:

>>    2) If I open the socket with a domain address, e.g. 
>> www.webphotospro.com, Mac OS X does a DNS lookup, puts up the rainbow 
>> rotating color cursor, and hangs until the DNS lookup fails.  On my 
>> machine this takes 60 seconds (apparently it's dependent on how many 
>> dns servers you have listed).
>
> What happens if you try:
>   hostNameToAddress("www.webphotospro.com")
> and use the result of that as the address for opening the socket?
> In my tests, this takes about 4 seconds the first time it is called if 
> I am connected (which is long enough for the SPOD to appear). When I 
> am disconnected, it fails instantly and return empty.
>
This is what libUrl does internally, so if you were connnecting via 
libUrl it would make no difference. But it might help when opening your 
own socket connections.

Alex Tweedly wrote:

> The engine can't return a response to the hostnametoaddress query 
> until it gets a response from the DNS server (or the query times out), 
> so it simply blocks until the time-out. That's probably reasonable (or 
> at least unavoidable) for a blocking call like hostNameToAddress, but 
> there needs to be a non-blocking version of it, for use in 
> non-blocking libURL and any other action which is not user-triggered 
> (or even to make the user-interruptable).

Right now, libUrl blocks until the socket connection is established, 
even for non-blocking calls, so even with engine changes, some 
modification would be needed. Perhaps this part of libUrl should be 
looked at again.

Going back to the original problem. There had been a lot of reports on 
OS X discussion groups about frequent failed DNS lookups . The typical 
symptom was a 60-second delay as the first lookup failed, but a 
subsequent lookup would work immediately. This affected some recent 
versions of Panther, possibly in combination with some of the security 
updates. I was affected for a while, but haven'r seen it recently. I'm 
assuming it was fixed in one of the many OS X updates. I'm just 
wondering if this was part of the problem. (But this is clearly not 
conected to Alex's description of the problem when the router is not 
connected.)

Cheers
Dave



More information about the use-livecode mailing list