Re: Time out operation
- From: Chendu <pjsenthil@xxxxxxxxx>
- Date: Wed, 30 Jan 2008 05:47:40 -0800 (PST)
On Jan 29, 11:16 pm, Pascal <pas...@xxxxxxxxx> wrote:
Chendu a écrit :
Case : I have to retrieve data from different servers.
I have to fetch the data from different servers, I am able to do this
in sequence.
Now problem is suppose one server is down, the script is hanging.
I wanted to include a time out option where in it tries for period of
time. if its timed out, It should continue and go to retrieve the data
from other servers.
How can i do this in TCL. There is not time out option.
time command is there, i dont think i can make use of it.
Can some one give suggestion for this.
Thanks
Senthilvelu
usage : vwaitTimed ::myvar 3000 (will timeout after 3 sec), and I
suppose ::mywar is set by server #n
################################################################################
# vwait but will timeout after a delay. Var must be fully qualified (::)
################################################################################
proc vwaitTimed { var {delay 0} {warn "warnuser"} } {
proc trigger {var warn} {
if {$warn == "warnuser"} {
tk_messageBox -type ok -icon error -parent . -title "Protocol
error" -message "vwait timeout for $var"
}
set $var 1
}
if { $delay != 0 } {
set timerId [after $delay "trigger $var $warn"]
}
vwait $var
if [info exists timerId] { after cancel $timerId }
}
Pascal- Hide quoted text -
- Show quoted text -
I am using a external command to get the data from the server.
.
- Follow-Ups:
- Re: Time out operation
- From: Chendu
- Re: Time out operation
- References:
- Time out operation
- From: Chendu
- Re: Time out operation
- From: Pascal
- Time out operation
- Prev by Date: Re: cygwin, ssh -X, wish break
- Next by Date: Re: Missing bindings when running a Tk app from C
- Previous by thread: Re: Time out operation
- Next by thread: Re: Time out operation
- Index(es):
Relevant Pages
|