[zeromq-dev] ZeroMQ C# client not receiving c Server Publish/Subscribe envelope

Amar Pol amarpol1305 at gmail.com
Wed Jan 16 11:29:55 CET 2013

 Dear all,

i m using zmq Publish/Subscribe envelope method to communicate each other.

actual setup is as follows:

    I am using publisher on server which is coded by using C and subscriber
as a
    client coded by using C#, and subscriber can successfully connected to
    but not able to receive messages sent by  publisher.

here is the code i have used


#include "zhelpers.h"

int main (void)
    //  Prepare our context and publisher
    void *context = zmq_init (1);
    void *publisher = zmq_socket (context, ZMQ_PUB);
    zmq_bind (publisher, "tcp://");

    while (1) {
        //  Write two messages, each with an envelope and content
        s_sendmore (publisher, "A");
        s_send (publisher, "We don't want to see this");
        s_sendmore (publisher, "B");
        s_send (publisher, "We would like to see this");
        sleep (1);
    //  We never get here but clean up anyhow
    zmq_close (publisher);
    zmq_term (context);
    return 0;


*using* *System*;
*using* *System.Text*;
*using* *ZMQ*;

*namespace* *ZMQGuide*
 *internal* *class* *Program*
 *public* *static* *void* Main(string[] args)
 *using* (var context = *new* Context(1))
 *using* (Socket subscriber = context.Socket(SocketType.SUB))
 subscriber.Subscribe("B", Encoding.Unicode);

*while* (*true*)
 string address = subscriber.Recv(Encoding.Unicode);
 string contents = subscriber.Recv(Encoding.Unicode);
 Console.WriteLine("{0} : {1}", address, contents);

please do reply.

Amar Pol
Software Engineer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130116/123cd4cb/attachment.htm>

More information about the zeromq-dev mailing list