Skip to content

Instantly share code, notes, and snippets.

@kessler
Created January 28, 2014 14:39
Show Gist options
  • Select an option

  • Save kessler/8668789 to your computer and use it in GitHub Desktop.

Select an option

Save kessler/8668789 to your computer and use it in GitHub Desktop.
dealer.js
var zmq = require('zmq')
var socket = zmq.socket('dealer');
socket.identity = 'client' + process.pid;
var value = 0;
socket.bind('tcp://127.0.0.1: ' + process.argv[2], function(err) {
if (err) throw err;
console.log('bound!');
setInterval(function() {
value++
console.log(socket.identity + ': asking ' + value);
socket.send(process.pid + '-' + value);
}, 1000);
socket.on('message', function(data) {
console.log(socket.identity + ': answer data ' + data);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment