Posted to tcl by patthoyts at Sat Jul 04 00:06:49 GMT 2009view pretty
test zlib-9.1 "check fcopy over socket" -constraints zlib -setup { set srv [socket -server {apply {{c a p} { chan configure $c -encoding binary -translation binary puts "connect $a:$p" puts -nonewline $c [zlib gzip [string repeat a 81920]] close $c }}} -myaddr localhost 0] set file [makeFile {} test.gz] } -body { lassign [chan configure $srv -sockname] addr name port puts "listen $addr $port" set s [socket $addr $port] chan configure $s -encoding binary -translation binary set f [open $file wb] puts "opened $s $f" fcopy $s $f puts "copied" close $s ; close $f file size $file } -cleanup { close $srv removeFile $file } -result {x}