Server:
set socket ""
proc acceptSocketConnection { a_sock an_addr a_port } {
global socket
set socket $a_sock
fconfigure $socket -buffering line -translation lf -blocking 0 -buffersize 72000
fileevent $socket readable processMessage
set ready 1
set datestamp 20110901
if { ![regexp -nocase windows $::tcl_platform(os)] } {
set l_genfile [file join [pwd] "strubio_${datestamp}.gen"]
puts $socket "GEN $l_genfile"
set l_matfile [file join [pwd] "strubio_${datestamp}.mat"]
puts $socket "NEW $l_matfile"
puts $socket "NEW $l_matfile"
}
}
proc processMessage { } {
global socket
gets $socket l_message
if {$l_message != ""} {
puts $l_message
}
}
set server [socket -server acceptSocketConnection -myaddr 127.0.0.1 2200]
vwait forever
Client:
set ::stru_pipe ""
set ::stru_executable "~/Documents/bin/osflm"
set l_sumfile "/home/g/Documents/parttest/stru_20110902_145832.sum"
set l_spotodfile "/home/g/.stru/stru_20110902_145832.spotod"
set l_coordsfile "/home/g/Documents/parttest/stru_20110902_145832.coords"
set ::stru_pipe [open "|\"$::stru_executable\" SUMMARY $l_sumfile SPOTOD $l_spotodfile COORDS $l_coordsfile MOSFLMSOCKET 2200"]
fileevent $::stru_pipe readable outputsinfo
proc outputsinfo { } {
global ::stru_pipe
gets $::stru_pipe linemess
puts $linemess
}
vwait forever