Created
July 9, 2012 10:31
-
-
Save zekizeki/3075659 to your computer and use it in GitHub Desktop.
node.js socket dump debug server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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