Posted to tcl by net vs http at Wed Oct 11 02:35:52 GMT 2017view raw

  1. ::tcl::tm::path add [pwd]
  2. package require net
  3. package require http
  4.  
  5. proc t(net) {url} {
  6. set s [net call $url]
  7. $s wait
  8. $s response data
  9. }
  10.  
  11. proc t(http) {url} {
  12. http::data [http::geturl $url]
  13. }
  14.  
  15. set url http://www.google.com/
  16.  
  17.  
  18. #puts [list [t(http) $url]]
  19. #puts [list [t(net) $url]]
  20. #exit
  21.  
  22. puts [time {t(http) $url} 10]
  23. puts [time {t(net) $url} 10]
  24.