Code: Select all
if {[catch {set sock [socket $myurl $myport] } err]} {
putlog "error: $err"
return 0
} else {
puts $sock "GET /administrator.cgi?pass=$adminpass&mode=viewxml HTTP/1.0"
puts $sock "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9)"
puts $sock "Host: $myurl"
puts $sock "Connection: close"
puts $sock ""
flush $sock
while {[eof $sock] != 1} {
# do this...
}
}
should i change it to.
Code: Select all
if {[catch {set sock [socket -async $myurl $myport] } err]} {
I also thought of changing
Code: Select all
puts $sock ""
flush $sock
to:
if [info exists sock] {close $sock}
Thank you.