Zeromq epgm pub / sub not working

I am working with an example node.js. I installed openpgm and zeromq 3.2 on my ubuntu 12.10 computer. Here is 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 another application:

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 tried these applications together on one computer, as well as on another computer on the network. I am pretty sure that I did not think up this part, but I can not find anything good about it. But I expected that it would still work on the same machine. Any ideas?

PS: I forgot to explain what exactly is happening: basically, the push program simply pops all messages without any error, and the pull program starts, but does not receive any message.

+4
source share
2 answers

Not sure if this helps, but I also experimented with zmq in node and made a few comments:

I use four machines: 1: OS X 10.8.3 2: Ubuntu 12.10 in VM (bridge) 3: separate Ubuntu 12.04 machine
4: standalone Ubuntu 12.04 machine

When I run the same test server on all machines (not too different from your code above) Machine 1: sees updates from machines 3 and 4 Machine 2: sees updates from 1, 2, 3 and 4 Machine 3: sees updates from 1, 3, 4 Machine 4: sees updates from 1, 3, 4

therefore, it seems that OS X blocks are broadcasting for themselves. Ubuntu 12.10 on the virtual machine gets everyone, but it has problems with sending (perhaps related to running in VM?), And other machines get their own.

My server / client:

 os = require 'os' zmq = require 'zmq' client = zmq.socket "sub" server = zmq.socket "pub" client.connect "epgm://224.0.0.1:5555", (error) -> if error? console.log "client error:", error client.subscribe "" client.on "message", (buffer) -> console.log "received ping:", buffer.toString! server.bind "epgm://224.0.0.1:5555", (error) -> if error? console.log "server error:", error setInterval ( -> server.send "#{os.hostname!}" ), 1000 process.on "SIGINIT", -> client.close! server.close! process.exit! 
+2
source

epgm and pgm work only for PUB / SUB.

+2
source

All Articles