Re: Time out question

2006-07-04 Thread Nick Craig-Wood
Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2006-07-03, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > > Alex Martelli <[EMAIL PROTECTED]> wrote: > >> DarkBlue <[EMAIL PROTECTED]> wrote: > >> > try for 10 seconds > >> >if database.connected : > >> > do your remote thing > >> > except ra

Re: Time out question

2006-07-03 Thread Rune Strand
Grant Edwards wrote: > I just use signal.alarm(): > > import signal,sys > > def alarmHandler(signum, frame): > raise 'Timeout' > > signal.signal(signal.SIGALRM, alarmHandler) > > while 1: > try: > signal.alarm(5) > t = sys.stdin.readline() > signal.alarm(0) >

Re: Time out question

2006-07-03 Thread Grant Edwards
On 2006-07-03, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > Alex Martelli <[EMAIL PROTECTED]> wrote: >> DarkBlue <[EMAIL PROTECTED]> wrote: >> > try for 10 seconds >> >if database.connected : >> > do your remote thing >> > except raise after 10 seconds >> >abort any connection attemp

Re: Time out question

2006-07-03 Thread Nick Craig-Wood
Alex Martelli <[EMAIL PROTECTED]> wrote: > DarkBlue <[EMAIL PROTECTED]> wrote: > > try for 10 seconds > >if database.connected : > > do your remote thing > > except raise after 10 seconds > >abort any connection attempt > >do something else > > Sure, see function setdefaulttim

Re: Time out question

2006-07-03 Thread DarkBlue
> > Sure, see function setdefaulttimeout in module socket. Just call it as > you wish before trying the DB connection and catch the resulting > exception. > > > Alex That should do it. Thanks Db -- http://mail.python.org/mailman/listinfo/python-list

Re: Time out question

2006-07-02 Thread Alex Martelli
DarkBlue <[EMAIL PROTECTED]> wrote: > My application makes several connections to > a remote database server via tcp/ip. > Usually all is fine,but occasionally the server is > down or the internet does not work and then there is > the 30 sec to several minutes timeout wait for the > tcp to give up