Posted to tcl by evilotto at Thu Jun 26 01:24:26 GMT 2014view raw

  1. package require http 2
  2.  
  3. namespace eval myNs {
  4.  
  5. proc onData {tok} {
  6. puts "callback with $tok"
  7. set state [array get $tok]
  8. puts "status: [dict get $state status]"
  9. puts "body: [dict get $state body]"
  10. http::cleanup $tok
  11. set ::forever 1
  12. }
  13.  
  14. http::geturl http://www.example.com/ -command [namespace which onData]
  15. }
  16.  
  17. vwait forever
  18.