11 verbose
"child: waiting a bit"
13 # This will be our client
17 set f
[socket stream localhost
:9876]
18 fconfigure $f -buffering line
23 if {[$f gets buf
] > 0} {
24 verbose
"child: read response '$buf'"
26 verbose
"child: read got eof"
32 verbose
"child: sending request"
33 $f puts -nonewline "GET / HTTP/1.0\r\n\r\n"
37 $f writable
[list onwrite
$f]
38 $f readable
[list onread
$f]
42 verbose
"child: in event loop"
44 verbose
"child: done event loop"
51 verbose
"parent: opening socket"
54 # This will be our server
55 set f
[socket stream.server
0.0.0.0:9876]
57 proc server_onread
{f
} {
58 verbose
"parent: onread (server) got connection on $f"
60 verbose
"parent: onread accepted $cfd"
62 verbose
"parent: read request '[string trim [$cfd gets]]'"
64 $cfd puts "Thanks for the request"
67 verbose
"parent: sent response"
72 $f readable
[list server_onread
$f]