var host = 'localhost' var port = '8080' var net = require('net'); net.createServer(function (socket) { socket.write("Echo server\r\n"); socket.on("data", function (data) { socket.write(data); }); }).listen(port, host); console.log('Server running at http://' + host + ':' + port + '/');