Posted to tcl by saedelaere at Sat Jan 02 10:18:35 GMT 2010view raw
- proc command_socket {} {
- catch {puts $::main(debug_msg) "\033\[0;1;33mDebug: command_socket \033\[0m"}
- if {"$::option(appname)" == "tv-viewer_main"} {
- set comsocket [open "$::option(where_is_home)/tmp/comSocket.tmp" w]
- close $comsocket
- }
- if {[file exists "$::option(where_is_home)/tmp/comSocket.tmp"]} {
- set comsocket [open "$::option(where_is_home)/tmp/comSocket.tmp" r]
- seek $comsocket 0 end
- set position [tell $comsocket]
- close $comsocket
- set ::data(comsocket) [open "$::option(where_is_home)/tmp/comSocket.tmp" a]
- fconfigure $::data(comsocket) -blocking no -buffering line
- set ::data(comsocket_id) [after 50 [list command_getData "$::option(where_is_home)/tmp/comSocket.tmp" $position]]
- }
- }