Re: Time out operation
- From: Chendu <pjsenthil@xxxxxxxxx>
- Date: Wed, 30 Jan 2008 06:02:15 -0800 (PST)
On Jan 30, 6:47 pm, Chendu <pjsent...@xxxxxxxxx> wrote:
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.- Hide quoted text -
- Show quoted text -
variable data // this is global
set ser { list of server}
foreach serverName $ser {
set data [getDatafrom $serverName]
}
Whats happening is when the server is down whole script is hanging. It
is now trying to get data from other servers
Now, how can i use vWaitTimed procedure . should the getDatafrom
should be passed as argument in place on var.
what the vwait does.
Senthil
.
- References:
- Time out operation
- From: Chendu
- Re: Time out operation
- From: Pascal
- Re: Time out operation
- From: Chendu
- Time out operation
- Prev by Date: Re: Why doesn't foreach return a value
- Next by Date: Package unloading
- Previous by thread: Re: Time out operation
- Next by thread: trace error
- Index(es):
Relevant Pages
|