Skip to content

Instantly share code, notes, and snippets.

@zekizeki
Created July 9, 2012 10:31
Show Gist options
  • Save zekizeki/3075659 to your computer and use it in GitHub Desktop.
Save zekizeki/3075659 to your computer and use it in GitHub Desktop.
node.js socket dump debug server
// a simple server that accepts connections on 1337 and then dumps and incoming data to standard out
// useful for debugging
var net = require('net');
var server = net.createServer(function (socket) {
socket.write('Echo server\r\n');
console.log('client connected');
socket.on('data',function(buffy){
process.stdout.write(buffy.toString('utf8', 0, buffy.length));
});
});
server.listen(1337, '127.0.0.1');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment