This is one of the beginner sockets code that anyone learns after he learns basic syntax and looping.
Doing this was easiest in python, perl,lua. But now you have node.js, the serverside javascript engine based on Google's V8 virtual machine. So here goes. I had to do this for a project. I need a simple TCP server written in node.js like this: #!/usr/local/bin/node var sys = require('sys'); /* system calls */ var exec = require('child_process').exec; // server require('net').createServer(function (socket) { console.log("connected"); socket.on('data', function (data) { str = "date"; console.log(str); exec(str); console.log(data.toString()); }); }) .listen(2000); Then the client: #!/usr/local/bin/node var s = require('net').Socket(); s.connect(2000, '127.0.0.1'); s.write('I got mail'); s.end(); Simple sockets based communication between two machines on the Internet. Sockets coding continues to amuse me. -Girish -- Gayatri Hitech http://gayatri-hitech.com _______________________________________________ ILUGC Mailing List: http://www.ae.iitm.ac.in/mailman/listinfo/ilugc ILUGC Mailing List Guidelines: http://ilugc.in/mailinglist-guidelines