Created
November 3, 2011 14:48
-
-
Save mafintosh/1336685 to your computer and use it in GitHub Desktop.
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
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