Skip to content

Instantly share code, notes, and snippets.

@heapwolf heapwolf/36.js
Created Aug 7, 2012

Embed
What would you like to do?
tcp/end
var server = require('net').createServer(function(socket) {
socket.setEncoding('utf8');
socket.on('data', function(data) {
if (data.trim() === 'end') {
socket.end('Bye bye!');
}
});
socket.on('end', function() {
console.log('ending connection');
});
});
server.listen(4001);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.