AMG: It's not too hard.
In this example there are two computers, client and server. The client's IP address is, let's say, 10.0.0.1. It will connect to the server (IP: 10.0.0.2) on TCP port 12345. Here's the code each side runs:
Client
set chan [socket 10.0.0.2 12345] puts $chan hello flush $chan puts "10.0.0.2:12345 says [gets $chan]" close $chan
Server
proc accept {chan addr port} { puts "$addr:$port says [gets $chan]" puts $chan goodbye close $chan } socket -server accept 12345 vwait forever
Of course the server is already up and running before the client starts.
What does it look like?
Client
10.0.0.2:12345 says goodbye
Server
10.0.0.1:49100 says hello
Discuss.
[ Category Network ]