42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
-
+
|
close $ch
set ::wait 1
}
}
proc read_nonblocking {host port path protocol} {
set result ""
# Open socket
set ch [::tls::socket -servername $host -request 1 -require 1 -alpn [list [string tolower $protocol]] $host $port]
chan configure $ch -blocking 1 -buffering line -buffersize 16384 -encoding utf-8 -translation {auto crlf}
fileevent $ch readable [list handler $ch]
# Initiate handshake
::tls::handshake $ch
|