Skip to content

Instantly share code, notes, and snippets.

@brapse
Created February 15, 2011 23:16
Show Gist options
  • Select an option

  • Save brapse/828493 to your computer and use it in GitHub Desktop.

Select an option

Save brapse/828493 to your computer and use it in GitHub Desktop.
var util = require('util');
var seq = new(EventEmitter);
var threads = 3;
var dead = 0;
// IPC
var pipe = netBinding.socketpair();
var sendStream = new(net.Stream)(pipe[0], 'unix');
sendStream.setNoDelay();
var receiveStream = new(net.Stream)(pipe[1], 'unix');
util.pump(sendStream, receiveStream);
sendStream.pipe(receiveStream, { end: false });
receiveStream.on('data', function (data) {
console.log(pid + 'received ' + data);
});
sendStream.end('lol');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment