#!/usr/bin/tclsh

proc stdinHandle {socketid} {
  gets stdin request
  puts $socketid $request
}

proc clientHandle {socketid} {
  gets $socketid request
  puts stdout $request
}  

set socketid [socket www 9010]

puts stdout $socketid

fileevent stdin readable "stdinHandle $socketid"
fconfigure stdin -buffering line

fileevent $socketid readable "clientHandle $socketid"
fconfigure $socketid -buffering line

vwait einelangezeit