0
我正在使用tcl的http包下载文件列表,并想知道处理中断的最佳方式是什么。眼下大纲我下载的程序是这样的:在Tcl中处理下载中断
proc downloadFiles {url_list folder_location} {
foreach {i} $url_list {
regsub {.*/(.*)$} $i {\1} $name
set out [open $folder_location/$name w+] //not worried about errors here
if {[catch {set token [http::geturl $i -channel $out]}]} {
puts "Could not download $i"
} else {
http::cleanup $token
puts "Downloaded $i"
}
close $out
}
}
我有问题,该生产线是catch语句:
catch {set token [http::geturl $i -channel $out]}
显然,尽管我切断了我的互联网和停止下载一半catch语句仍然返回0表示错误。有没有办法解决这个问题?
谢谢,工作得很好。 – NorthGuard 2010-07-23 16:29:04