Skip to content

Instantly share code, notes, and snippets.

@mafintosh
Created November 3, 2011 14:48
var net = require('net');
net.createServer(function(socket) {
socket.setTimeout(10*1000, function() {
console.log('timeout!!');
socket.destroy();
});
setInterval(function() {
if (socket.writable) {
socket.write(Date.now()+'\n');
}
}, 1000);
}).listen(8888);
// and run: nc localhost 8888
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment