Posted to tcl by sbron at Sun Nov 11 12:46:02 GMT 2007view raw
- #!/usr/bin/tclsh
- set sock [socket localhost 8765]
- fileevent $sock readable [list process $sock]
- proc process {f} {
- if {[eof $f]} {
- close $f
- exit
- } elseif {[gets $f line]} {
- foreach n {code repeat button remote} v $line {
- puts "$n: $v"
- }
- puts ""
- }
- }
- vwait forever
Comments
Posted by sbron at Sun Nov 11 12:47:54 GMT 2007 [text] [code]
Make that: } elseif {[gets $f line] != -1} {