[zeromq-dev] 0MQ/2.0-alpha3 available

Martin Sustrik sustrik at fastmq.com
Wed Sep 23 13:08:22 CEST 2009


Hi all,

New version of 0MQ/2.0 was released today:

http://www.zeromq.org/area:download-v20-alpha3

New features include "multicast bus" and "request/reply sockets".

Multicast bus allows multiple applications to write and read to/from a 
single multicast group. This is to be opposed to a simple multicast 
scenario with a single sender and multiple receivers.

Request/reply sockets simplify development of RPC, SOA and client/server 
applications.

For instance, to create a server application such as web server it's 
sufficient to do the following:

zmq::context_t ctx (1, 1);
zmq::socket_t s (ctx, ZMQ_REP);
s.bind ("tcp://eth0:5555");

while (true) {
     zmq::message_t request;
     s.recv (&request);
     zmq::message_t reply;

     ... process the request and construct the reply here ...

     s.send (reply);
}

To create a client application - such as web browser - do the following:

zmq::context_t ctx (1, 1);
zmq::socket_t s (ctx, ZMQ_REQ);
s.connect ("tcp://192.168.0.111:5555");

zmq::message_t request;

... construct the request here ...

s.send (request);
zmq::message_t reply;
s.recv (&reply);

... process the reply here...

Enjoy!
Martin



More information about the zeromq-dev mailing list