# + na uzytek sieci PPP miedzy VBox/puppy
socket -server obsluga 5000
#socket -server obsluga 5001
proc obsluga {s args} {set ::sock $s}
proc kopiuj {s1 s2} {
if {[eof $s1] || [eof $s2]} {
close $s1; close $s2
puts "///koniec pol. $s1 i $s2"; return
}
set x [read $s1]; puts -nonewline $s2 $x; flush $s2
puts "$s1 -> $s2, [string len $x] b, sec=[clock sec]"
}
while 1 {
vwait sock
set s1 $sock
vwait sock
set s2 $sock
puts "laczymy $s1 i $s2"
fconfigure $s1 -translation binary -blocking 0
fconfigure $s2 -translation binary -blocking 0
fileevent $s1 readable "kopiuj $s1 $s2"
fileevent $s2 readable "kopiuj $s2 $s1"
}
#fcopy $s1 $s2 -command "koniec"
#fcopy $s2 $s1 -command "koniec"
# + to nie dziala bo nie mozna uzywac chan
# bedacych w uzyciu przez pierwsze fcopy!!