#!/usr/bin/tclsh

proc serverrequest { socketid } {
  gets $socketid request
  puts $socketid "Antwort: $request"
}

proc serverhandle { socketid ipaddr portno } {
  puts "Socket-ID: $socketid / IP-Adresse Client: $ipaddr / Portnummer Client: $portno"
  fileevent $socketid readable "serverrequest $socketid"
  fconfigure $socketid -buffering line
}

socket -server serverhandle 9010

vwait wartebisinalleewigkeit