1 package require TclCurl
3 proc Perform {multiHandle} {
4 if {[catch {$multiHandle active} activeTransfers]} {
5 puts "Error checking active transfers: $activeTransfers"
9 if {[catch {$multiHandle perform} running]} {
10 puts "Error: $running"
16 proc StartTransfer {multiHandle} {
18 set runningTransfers [Perform $multiHandle]
19 if {$runningTransfers>0} {
27 set curlEasyHandle [curl::init]
29 $curlEasyHandle configure -url http://127.0.0.1/ -file index.html
31 if {[catch {curl::multiinit} curlMultiHandle]} {
32 puts "Error with multi handle init"
35 puts "The multi handle: $curlMultiHandle"
37 puts -nonewline "We add the easy handle: "
38 puts [$curlMultiHandle addhandle $curlEasyHandle]
40 StartTransfer $curlMultiHandle
42 puts "Calling getinfo [$curlMultiHandle getinfo]"
44 puts -nonewline "Removing the easy handle: "
45 puts [$curlMultiHandle removehandle $curlEasyHandle]
47 puts -nonewline "Cleanup the multi handle handle: "
48 puts [$curlMultiHandle cleanup]
50 $curlEasyHandle cleanup