Here's the basic script for server side stuff:
#Set up a server socket on port 14000, with a callback to the socketAccept procedure:
set s [socket -server socketAccept 14000]
#This proc gets the socket connection from any client connection. It will be called with the open handle identifier, the address of the client, and the connecting port. The only one we really care about for communications purposes is the sock argumane.
proc socketAccept {sock addr port} {
gets $sock buffer
puts $sock "Thanks for $buffer"
#Flush so the client sees it right away.
flush $sock
#If we are done, then close the socket...
close $sock
}
Run the above, then telnet into the machione at 14000:
telnet localhost 14000
$hello
Thanks for hello
Connection closed by foreign host
Play. Enjoy. If you are not having fun, then you are not doing it right.
Mike Suttles
Xerox OPBU Technology Development Group