Posted to tcl by crshults at Mon Jun 15 18:26:04 GMT 2015view pretty
set port 9000 proc read_data {sock} { puts [read $sock] if {[chan eof $sock]} { puts "chan is eof" chan event $sock readable {} chan close $sock } } proc uniform {str} { global port set sock [socket localhost $port] chan configure $sock -translation binary -buffering none -blocking no set msg "RCTL\nBEGIN\n${str}\nEND" chan event $sock readable "read_data $sock" chan puts $sock $msg } uniform "some task"