I am working with the node.js example. I have installed openpgm and zeromq 3.2 on my ubuntu 12.10 machine. Here's the code:
var zmq = require('zmq')
, port = 'epgm://eth0;239.192.1.1:5555';
var socket = zmq.socket('pub');
socket.identity = 'publisher' + process.pid;
var stocks = ['AAPL', 'GOOG', 'YHOO', 'MSFT', 'INTC'];
socket.bind(port, function(err) {
if (err) throw err;
console.log('bound!');
setInterval(function() {
var symbol = stocks[Math.floor(Math.random()*stocks.length)]
, value = Math.random()*1000;
console.log(socket.identity + ': sent ' + symbol + ' ' + value);
socket.send(symbol + ' ' + value);
}, 1000);
});
and the other app:
var zmq = require('zmq') , port = 'epgm://eth0;239.192.1.1:5555';
var socket = zmq.socket('sub');
socket.identity = 'subscriber' + process.pid;
socket.connect(port);
socket.subscribe('AAPL'); socket.subscribe('GOOG');
console.log('connected!');
socket.on('message', function(data) { console.log(socket.identity + ': received data ' + data.toString()); });
I am not sure if I am using the correct multicast addressing. I have tried these apps together in the same machine, and also in another machine in the network. I am pretty sure I have not thought through that part, but I can't seem to find any good explanation about it anywhere. But I expected this to work on the same machine anyway. Any ideas?
PS: Forgot to explain what exactly happens: Basically the push program just pushes all the messages without any error, and the pull program starts but doesn't receive any message.