From: jam at newimage.com (jam)
Date: Mon, 26 Apr 1999 08:18:42 -0400
Subject: timeout on urllib.urlopen?
In-Reply-To: <m3k8uzwq15.fsf@gondolin.beleriand>; from Steffen Ries on Mon, Apr 26, 1999 at 07:59:50AM -0400
References: <7g0r7c$gn9$1@nnrp1.dejanews.com> <19990426061959.A18551@toast.internal> <m3k8uzwq15.fsf@gondolin.beleriand>
Message-ID: <19990426081842.C18551@toast.internal>
X-UID: 346                                                  

On Mon, Apr 26, 1999 at 07:59:50AM -0400, Steffen Ries wrote:
> 
> I used once SIGALRM to force a timeout. Maybe somebody could comment
> on that approach?
> 
> 
> /steffen
> 
[..snipped code..]

greetings,

all well and good (the more ideas the better), except that if something goes
wrong, all you get is that a timeout happened within 120 seconds.. with the
'select' approach, you have a chance to record the specific error that the
socket had.. sometimes the server is down ('connection refused'), sometimes
the web server itself is having problems, sometimes the network is down,
etc.. you can import additional 'errno' symbols and trap them if necessary,
and even specify a timeout to the select call, so you can trap that
seperately as well.

hope that helps.

regards,
J
-- 
|| visit gfd <http://quark.newimage.com:8080/> 
|| psa member #293 <http://www.python.org/> 
|| New Image Systems & Services, Inc. <http://www.newimage.com/>




