Posted to tcl by aspect at Tue Jul 08 03:31:03 GMT 2014view pretty

namespace eval nopchan {
    proc initialize args {
        info procs
    }
    proc finalize args {}
    proc clear args {}
    proc write {h data} {
        return $data
    }
    proc read {h data} {
        return $data
    }

    namespace export *
    namespace ensemble create
}

proc logit {s} {
    puts data:[gets $s]
    if {[eof $s]} {close $s}
}

puts Tcl:[info patchlevel]
puts tls:[package require tls]

set sock [tls::socket google.com 443]
chan push $sock nopchan
puts -nonewline $sock "GET" ;# need to write something first
chan configure $sock -blocking 0
#chan event $sock readable logit
catch {flush $sock} e o
puts $e
dict for {k v} $o {puts [list $k $v]}

# Tcl:8.6.1
# tls:1.6
# error flushing "sockadd830": invalid argument
# -code 1
# -level 0
# -errorstack {INNER {invokeStk1 flush sockadd830}}
# -errorcode {POSIX EINVAL {invalid argument}}
# -errorinfo {error flushing "sockadd830": invalid argument
#     while executing
# "flush $sock"}
# -errorline 1