Re: Socket timeout not working with libUrl

2005-02-01 Thread Dave Cragg
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
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Socket timeout not working with libUrl

2005-02-01 Thread Frank Leahy
Sarah,
Unfortunately there's two types of being disconnected.  One where 
you've no net connection at all, and one where you're on a LAN, but not 
connected to the Internet.  Here in Cornwall I have only modem access, 
so I've a LAN but no net connection most of the time, which is how I 
stumbled across this problem.

The issue appears to be how Mac OS X does DNS lookups.  The routine 
lookupd appears to be the culprit, and RunRev would need to modify 
how they call it to make it non-blocking.

-- Frank
Web Photos Pro: Software for Photo Bloggers and Other Photo Power Users
See us on the web at http://www.webphotospro.com/
On Feb 1, 2005, at 4:59 AM, [EMAIL PROTECTED] 
wrote:

From: Sarah Reichelt [EMAIL PROTECTED]
Subject: Re: Socket timeout not working with libUrl
To: How to use Revolution use-revolution@lists.runrev.com
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=US-ASCII; format=flowed
   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.
Sarah
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Socket timeout not working with libUrl

2005-02-01 Thread James Richards
If this is an OS X 10.3.7 issue, some people have been able to kludge a 
fix for it by entering their ISP's DNS server addresses into the 
relevant pane in Network preferences.  But if it is the identified 
10.3.7 problem, you would be likely to have experienced long delays in 
opening Apple's Mail program.

Regards
James
--
James J Richards
[EMAIL PROTECTED]
Tel. +44 (0)15394 43063
On 1 Feb, 2005, at 14:17, [EMAIL PROTECTED] wrote:
Message: 7
Date: Mon, 31 Jan 2005 18:40:22 +0100
From: R. Hillen [EMAIL PROTECTED]
Subject: Re: use-revolution Digest, Vol 16, Issue 103
To: use-revolution@lists.runrev.com
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=US-ASCII; format=flowed
Hello Frank,
I would guess that you are using OSX 10.3.7; right?
That could explain your DNS-Problem, as Apple has changed its
DNS-calls. So If I start Apple Mail, I have to wait 50 seconds.
Apple told, that it is a bug, so wait for 10.3.8 or return to 10.3.6.
Hope it explains.
Richard.
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Socket timeout not working with libUrl

2005-01-31 Thread Frank Leahy
Sarah,
Thanks for the reply.
After a lot of testing on Mac OS X, I've found that the problem I was 
having appears to be due to the way that Mac OS X does DNS lookups.  
Whether or not it's a RunRev bug as well is hard to tell, but I think 
it might be.

Here's some sample code I wrote.  This code sends a My5SecondTimeout 
message to itself, opens a socket, makes an HTTP GET request, waits for 
the response, and closes the socket.  (Note: I had to use this 
My5SecondTimeout message because setting the socketTimeoutInterval 
doesn't seem to work).

When you run this script and you're not connected to the internet 
here's what happens:

   1) If I open the socket with an ip address, e.g. 64.125.128.80, my 5 
second timer will fire, and I can close the socket and exit from the 
routine.

   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).

I'm guessing this is a RunRev bug, but I can't be sure.  Basically 
RunRev hangs for 60 seconds while the DNS lookup takes place during the 
open socket call -- it doesn't send a socket timeout, and it doesn't 
the My5SecondTimeout message either.

Can confirm this?
Thanks,
-- Frank
on mouseUp
  set the socketTimeoutInterval to 5000 -- this seems to do nothing, 
but set it anyway
  global theIp, socketIsOpen, socketTimedOut
  put www.webphotospro.com:80 into theIp -- using this causes RunRev 
to hang for 60 seconds
  -- put 64.125.128.80:80 into theIp -- using this does not cause a 
hang
  put false into socketIsOpen
  put false into socketTimedOut

  send My5SecondTimeout to button Ping in 5 seconds -- send a 
message to myself
  close socket theIp -- in case it's currently open
  open socket to theIp with message mySocketOpenMsg
  wait until socketIsOpen or socketTimedOut with messages
  if socketTimedOut then
close socket theIp
answer socket timed out
  end if
end mouseUp

on My5SecondTimeout
  global socketIsOpen, socketTimedOut
  if not socketIsOpen then
put true into socketTimedOut
  end if
end My5SecondTimeout
on mySocketOpenMsg theParams
  global theIp, socketIsOpen
  put true into socketIsOpen
  write GET / HTTP/1.0  numToChar(13)  numToChar(10)  
numToChar(13)  numToChar(10) to socket theIp
  read from socket theIp for 50 with message mySocketReadDoneMsg
end mySocketOpenMsg

on mySocketReadDoneMsg socketId, theData
  global theIp
  close socket theIp
  answer read done:   socketId  theData
end mySocketReadDoneMsg
Web Photos Pro: Software for Photo Bloggers and Other Photo Power Users
See us on the web at http://www.webphotospro.com/
On Jan 31, 2005, at 1:16 AM, [EMAIL PROTECTED] 
wrote:

From: Sarah Reichelt [EMAIL PROTECTED]
Subject: Re: Socket timeout not working with libUrl
To: How to use Revolution use-revolution@lists.runrev.com
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=US-ASCII; format=flowed
My product pings the Web Photos Pro website to look for new versions.
This works great when the computer the product's running on is
connected to the internet, but it hangs for 60 seconds when there's no
net connection.
My code looks like this:
  set the socketTimeoutInterval to 5000
  put URL (getPhotoAlbumUrl()  downloads/version_info.php) into
newVersion
Is there any way I can force a timeout after 5 seconds?  Should I be
using a non-blocking URL request?  Should I be attempting to open a
socket directly to do an initial am I connected to the internet?
request, before making the URL request?
Hi Frank,
I would definitely use a non-blocking request, so the user won't even
notice if it is trying  failing.
Try something like:
   set the socketTimeoutInterval to 5000
   put (getPhotoAlbumUrl()  downloads/version_info.php) into tURL
   load tURL with message gotVersion
Then you need a gotVersion handler in the same object:
on gotVersion
   put URL (getPhotoAlbumUrl()  downloads/version_info.php) into
newVersion
   -- check newVersion  do the usual stuff
end gotVersion
Hope this helps,
Sarah
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Socket timeout not working with libUrl

2005-01-31 Thread Alex Tweedly
Frank Leahy wrote:
After a lot of testing on Mac OS X, I've found that the problem I was 
having appears to be due to the way that Mac OS X does DNS lookups.  
Whether or not it's a RunRev bug as well is hard to tell, but I think 
it might be.

Here's some sample code I wrote.  This code sends a My5SecondTimeout 
message to itself, opens a socket, makes an HTTP GET request, waits 
for the response, and closes the socket.  (Note: I had to use this 
My5SecondTimeout message because setting the socketTimeoutInterval 
doesn't seem to work).

When you run this script and you're not connected to the internet 
here's what happens:

   1) If I open the socket with an ip address, e.g. 64.125.128.80, my 
5 second timer will fire, and I can close the socket and exit from the 
routine.

   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).

I'm guessing this is a RunRev bug, but I can't be sure.  Basically 
RunRev hangs for 60 seconds while the DNS lookup takes place during 
the open socket call -- it doesn't send a socket timeout, and it 
doesn't the My5SecondTimeout message either.

Can confirm this?
Yes.
you may have missed the email I sent earlier in this thread, re bug 2117 
Engine blocks on DNS query

Take a look at that bug report for more details. You can check for 
dnsservers - which will prevent the problem occurring in most cases, but 
there are still some cases where it will fail.

-- Alex.

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.6 - Release Date: 27/01/2005
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Socket timeout not working with libUrl

2005-01-31 Thread Alex Tweedly
Alex Tweedly wrote:
When you run this script and you're not connected to the internet 
here's what happens:

   1) If I open the socket with an ip address, e.g. 64.125.128.80, my 
5 second timer will fire, and I can close the socket and exit from 
the routine.

   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).

I'm guessing this is a RunRev bug, but I can't be sure.  Basically 
RunRev hangs for 60 seconds while the DNS lookup takes place during 
the open socket call -- it doesn't send a socket timeout, and it 
doesn't the My5SecondTimeout message either.

Can confirm this?

Yes.
you may have missed the email I sent earlier in this thread, re bug 
2117 Engine blocks on DNS query

Take a look at that bug report for more details. You can check for 
dnsservers - which will prevent the problem occurring in most cases, 
but there are still some cases where it will fail.
Unfortunately, BZ 2117 is currently being treated as a problem with 
RevOnline, rather than dealing with the fundamental problem of there 
being no way to query DNS without the risk of blocking for 40-120 
seconds (or longer). Your experiments above prove that it is a 
fundamental problem, applying even to the non-blocking parts of libURL.

Since BZ 2117 has been closed once already as can't be fixed, you may 
want to open a Bugzilla report to record the general problem, and simply 
mention 2117 as a special case of it. Even though it can't be fixed in 
the normal case (of, e.g., put URL ...) it can easily be provided as a 
non-blocking function, for use within non-blocking functions such as 
libURL, or revonline checks.

In the meantime, there is a work-around - but it's pretty ugly .
1. write a shell script which does a ping to the machine you need to 
talk to, and saves its results to a log file.
In my case, I created a file calledC:\MYPING.BATwhich contains

ping www.tweedly.net  c:\ping.txt
(of course, you could create this dynamically, so as to handle any 
target machine).

2. In your app, launch this shell script then start a timer to check 
for the existence of the log file, and then check the results

local lStart
on mouseUp
  delete file C:/ping.txt
  set hideconsolewindows to true   -- Win only
  put the seconds into lStart
  launch C:/myping.bat
  send tryNow to me in 5 seconds
end mouseUp
 
on tryNow
  local tFile
  put trying  (the seconds - lStart)  cr after field lockedField
  if there is a file C:/ping.txt then
put URL file:c:/ping.txt into tFile
filter tFile with *Reply*
if the number of lines in tFile  0 then
  put success   word 3 of line 1 of tFile  cr after field 
lockedField
  exit tryNow
end if
  end if
  if (the seconds - lStart)  80 then
put failure after 80 secs  cr after field lockedField
  else
send tryNow to me in 5 seconds
  end if
end tryNow
3. handle the minor variants needed for each platform 
(note - tested in my situation where I regularly encounter the problem 
you described. While I can't think of other circumstances where I would 
expect this to fail, I haven't done extensive testing of other scenarios).

Or, alternatively, .
instead of using www.webphotospro.com, use the hard-wired IP address; 
when that fails, use another hard-wired address to check for the 
presence of an Internet connection - and only then try again using the 
hostname (and store the IP address used). This last (blocking) case will 
only happen when  your web site address has changed, and the user has an 
internet connection, but his DNS servers are either dead or unreachable 
- which is going to be very rare for any reasonable ISP. 

-- Alex.

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.6 - Release Date: 27/01/2005
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Socket timeout not working with libUrl

2005-01-31 Thread Sarah Reichelt
   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.

Sarah
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Socket timeout not working with libUrl

2005-01-31 Thread Alex Tweedly
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.
It depends how you are connected.
If you do it on a machine directly connected to the Internet (e.g. my 
laptop dialled into my ISP), then it will fail immediately (because it 
knows the DNS server (obtained in this case by PPP negotiation)  is 
unreachable).

If you do this on a host which is connected to a LAN and (has been) 
using a router attached to the LAN to connect, and the router (and/or 
NAT box) has been configured (e.g. through DHCP) as the DNS server for 
the host, and the router has lost its Internet connection, THEN it will 
block for 15-120 seconds before failing. (example - my laptop, connected 
through another PG running Win Internet Connection Sharing to a dial-up 
line). 
{Note - if you're testing this, remember the address will be kept in the 
router's DNS resolver cache, so after any successful attempt, you need 
to either wait or change the host name you are looking up - that just 
caught me out when I tried this in preparation to send this email :-].

No doubt there are other circumstances where it would similarly fail 
(e.g. maybe the case of a router hop between the host and the DNS 
router/server, and the router-to-router link was down - but I haven't 
test that one yet; it would depend on whether the intermediate router 
was proxying DHCP or sub-leasing - and I suspect there are too many 
variants to be worth getting into them).

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).

-- Alex.

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.6 - Release Date: 27/01/2005
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Socket timeout not working with libUrl

2005-01-30 Thread Sarah Reichelt
My product pings the Web Photos Pro website to look for new versions.  
This works great when the computer the product's running on is 
connected to the internet, but it hangs for 60 seconds when there's no 
net connection.

My code looks like this:
  set the socketTimeoutInterval to 5000
  put URL (getPhotoAlbumUrl()  downloads/version_info.php) into 
newVersion

Is there any way I can force a timeout after 5 seconds?  Should I be 
using a non-blocking URL request?  Should I be attempting to open a 
socket directly to do an initial am I connected to the internet? 
request, before making the URL request?

Hi Frank,
I would definitely use a non-blocking request, so the user won't even 
notice if it is trying  failing.
Try something like:
  set the socketTimeoutInterval to 5000
  put (getPhotoAlbumUrl()  downloads/version_info.php) into tURL
  load tURL with message gotVersion

Then you need a gotVersion handler in the same object:
on gotVersion
  put URL (getPhotoAlbumUrl()  downloads/version_info.php) into 
newVersion
  -- check newVersion  do the usual stuff
end gotVersion

Hope this helps,
Sarah
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Socket timeout not working with libUrl

2005-01-28 Thread Frank Leahy
Hi,
My product pings the Web Photos Pro website to look for new versions.  
This works great when the computer the product's running on is 
connected to the internet, but it hangs for 60 seconds when there's no 
net connection.

My code looks like this:
  set the socketTimeoutInterval to 5000
  put URL (getPhotoAlbumUrl()  downloads/version_info.php) into 
newVersion

Is there any way I can force a timeout after 5 seconds?  Should I be 
using a non-blocking URL request?  Should I be attempting to open a 
socket directly to do an initial am I connected to the internet? 
request, before making the URL request?

Thanks in advance for any suggestions.
Regards,
-- Frank
Web Photos Pro: Software for Photo Bloggers and Other Photo Power Users
See us on the web at http://www.webphotospro.com/
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Socket timeout not working with libUrl

2005-01-28 Thread Alex Tweedly
Frank Leahy wrote:
Hi,
My product pings the Web Photos Pro website to look for new versions.  
This works great when the computer the product's running on is 
connected to the internet, but it hangs for 60 seconds when there's no 
net connection.

My code looks like this:
  set the socketTimeoutInterval to 5000
  put URL (getPhotoAlbumUrl()  downloads/version_info.php) into 
newVersion

Is there any way I can force a timeout after 5 seconds?  Should I be 
using a non-blocking URL request?  Should I be attempting to open a 
socket directly to do an initial am I connected to the internet? 
request, before making the URL request?

Frank,
it may depend on how the computer has no internet connection. Normally 
if there is no connection at all, it will fail immediately. I ran into a 
problem (with Revonline) that if the computer has a working connection 
to a router or other connecting machine, then it can fail.

See Bugzilla 2117 for some more info and a hint of a possible workaround 
from Mark.

I think you could also use a non-blocking URL request, if that was easier.
-- Alex.

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.6 - Release Date: 27/01/2005
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution