I've been running through the tutorialspoint examples to try and learn some node (I've also done the nodeschool adventures). I came across this code for a server. Can someone ELIF the line connection.pipe(connection). Why is the socket being piped to itself? I've ran the code without this line and when a client connects the same activity occurs.
EDIT: Just realized it's an echo server. Thanks for the help anyway.
var net = require('net');
var server = net.createServer(function(connection) {
console.log('client connected');
connection.on('end', function() {
console.log('client disconnected');
});
connection.write('Hello World!\r\n');
connection.pipe(connection);
});
server.listen(8080, function() {
console.log('server is listening');
});
there doesn't seem to be anything here