Posted to tcl by saedelaere at Sat Jan 02 10:18:35 GMT 2010view raw

  1. proc command_socket {} {
  2. catch {puts $::main(debug_msg) "\033\[0;1;33mDebug: command_socket \033\[0m"}
  3. if {"$::option(appname)" == "tv-viewer_main"} {
  4. set comsocket [open "$::option(where_is_home)/tmp/comSocket.tmp" w]
  5. close $comsocket
  6. }
  7. if {[file exists "$::option(where_is_home)/tmp/comSocket.tmp"]} {
  8. set comsocket [open "$::option(where_is_home)/tmp/comSocket.tmp" r]
  9. seek $comsocket 0 end
  10. set position [tell $comsocket]
  11. close $comsocket
  12. set ::data(comsocket) [open "$::option(where_is_home)/tmp/comSocket.tmp" a]
  13. fconfigure $::data(comsocket) -blocking no -buffering line
  14. set ::data(comsocket_id) [after 50 [list command_getData "$::option(where_is_home)/tmp/comSocket.tmp" $position]]
  15. }
  16. }