The machine name is correct, though per your suggestion I did try LocalHost in the server script and IP in my client script. Unfortunetly, I got the same results, 'Could not create socket: Connection refused' and I still do not see the connection doing 'netstat -a'.
mmm, maybe my post was a bit confusing. When I tried 'localhost ' on my own machine, I did that because my machine's name is not 'foo'. You better put the same IP-address in both scripts. If you put 'localhost' in the 'LocalHost' hash-key to build a new socket this socket will not be accessible from other machines on the network (under normal circumstances).
But even with LocalHost => 'localhost' in your script I'd at least expect you to see a listening port when you do a 'netstat -a'. Maybe it's better to do 'netstat -an' so your TCP and UDP portnumers are not translated to servicenames. Another way to see if you've got a listening TCP port is to use telnet to connect to this service. For instance to check a connection on TCP port 1800 on host 1.1.1.1: