
if {$argc!=1} {puts stderr "Usage: srv.tcl <inipause>";exit 1}
set dt [lindex $argv 0]

proc pause t {
    if {!$t} return
    puts PAUSE:$t
    after $t
}

proc insok {sok args} {
    set ::s $sok
}
socket -server insok 1111
vwait s
puts GOT-CLIENT
fconfigure $s -buffering line

pause $dt

gets $s line
puts RCV:$line

pause 1000

if {[catch {puts $s YOYODYNE} err]} {
    puts ERR:$err
    set rest [read $s]
    puts REST:$rest
} else {
    puts NOLUCK
}


