**Communicating with other programs - socket, fileevent** !!!!!! '''[Tcl Tutorial Lesson 26%|%Previous lesson%|%]''' | '''[Tcl Tutorial Index%|%Index%|%]''' | '''[Tcl Tutorial Lesson 27%|%Next lesson%|%]''' !!!!!! TODO: lesson on socket and fileevent (or "chan event" in 8.5). But see also [Tcl Tutorial Lesson 40%|%Lesson 40: socket, fileevent, vwait%|%] ---- ***Example*** ====== # # A little echo server # proc accept {socket address port} { puts "Accepted connection $socket from $address\:$port" # Copy input from the socket directly back to the socket chan copy $socket $socket -command [list finish $socket] } proc finish {socket args} { puts "Closed $socket" catch { chan close $socket } } socket -server accept 8080 # Start the event loop by waiting on a non-existant variable 'forever' vwait forever ====== !!!!!! '''[Tcl Tutorial Lesson 26%|%Previous lesson%|%]''' | '''[Tcl Tutorial Index%|%Index%|%]''' | '''[Tcl Tutorial Lesson 27%|%Next lesson%|%]''' !!!!!!