Skip to content

Instantly share code, notes, and snippets.

@isaacs
Last active December 14, 2015 10:09
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isaacs/5069656 to your computer and use it in GitHub Desktop.
Save isaacs/5069656 to your computer and use it in GitHub Desktop.
var net = require('net');
var server = net.createServer({ allowHalfOpen: true }, function(sock) {
sock.on('data', function(c) {
console.error('SERVER data %j', c.toString());
});
sock.on('end', function() {
console.error('SERVER message received, responding');
sock.write('hello1');
sock.write('hello2');
sock.write('hello3');
sock.end('THUNDERMUSCLE!');
});
});
server.listen(1337);
var sock = net.connect(1337);
sock.on('data', function(c) {
console.error('CLIENT data %j', c.toString());
});
sock.on('end', function() {
console.error('CLIENT end');
});
sock.write('hello1');
sock.write('hello2');
sock.write('hello3');
sock.end('THUNDERMUSCLE!');
Copy link

ghost commented Mar 2, 2013

'THUNDERMUSCLE!'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment