[zeromq-dev] How to use the PGM

仇立偉 liwei_chour at mail.apex.com.tw
Wed Sep 4 04:41:48 CEST 2013


Hi:
 Thanks! It works. 
 But the speed of PGM is too slow. Using TCP, I can send 2000 tick per second, 1.6Mbps. Using PGM, I just send 120 tick per second( the same program).
 Base on the http://api.zeromq.org/3-2:zmq-setsockopt, I set
    int rate = 5000;
    rc = zmq_setsockopt (s, ZMQ_RATE, &rate, sizeof(int));
 to change the speed of PGM. But it doesn't work.
 Where should I do?

Sincerely
Liwei Chour in OFFICe

-----Original Message-----
From: zeromq-dev-bounces at lists.zeromq.org [mailto:zeromq-dev-bounces at lists.zeromq.org] On Behalf Of Pieter Hintjens
Sent: Tuesday, September 03, 2013 5:00 PM
To: ZeroMQ development list
Subject: Re: [zeromq-dev] How to use the PGM

- make sure you're using "pgm://" and not "pmg://"
- do you have compatible network switches?
- try using epgm to see if that works
- publisher and subscriber must be on different hosts

-Pieter

On Tue, Sep 3, 2013 at 8:36 AM, 仇立偉 <liwei_chour at mail.apex.com.tw> wrote:
> Hi:
>
>   I use the PUB-SUB pattern in my program. When I use the TCP protocol, It
> works fine. But I change to the PGM protocol(using the same code), I can
> send data, but can’t receive any data. Following are the Code
>
>
>
> //Sender Code
>
>     ctx = zmq_init (1);
>
>     s = zmq_socket (ctx, ZMQ_PUB);
>
>     rc = zmq_bind (s, "tcp://192.168.12.100:8888”);
>
>     for (i = 0; i != 1000; i++) {
>
>         rc = zmq_msg_init_size (&msg, 50);
>
>         unsigned char *msg_point = (unsigned char *)zmq_msg_data(&msg);
>
>         memcpy(msg_point, (unsigned char *)&order, sizeof(unsigned int));
>
>         rc = zmq_sendmsg (s, &msg, 0);
>
>         rc = zmq_msg_close (&msg);
>
>         order++;
>
>     }
>
>     rc = zmq_close (s);
>
>     rc = zmq_term (ctx);
>
>
>
> //Receive Code
>
>     ctx = zmq_init (1);
>
>     s = zmq_socket (ctx, ZMQ_SUB);
>
>     rc = zmq_connect (s, "tcp://192.168.12.100:8888”);
>
>     rc = zmq_setsockopt (s, ZMQ_SUBSCRIBE, "", 0);
>
>     rc = zmq_msg_init_size (&msg, message_size);
>
>     while(1) {
>
>         rc = zmq_recvmsg (s, &msg, 0);
>
>         unsigned char *msg_point = (unsigned char *)zmq_msg_data(&msg);
>
>         memcpy((unsigned char *)&order, msg_point, sizeof(unsigned int));
>
>         print(“Get size=%d order=%d\n”, rc,order);
>
>     }
>
>     rc = zmq_close (s);
>
>     rc = zmq_term (ctx);
>
>
>
> If I change “tcp://192.168.12.100:8888” to
>pmg://192.168.12.100;239.192.1.1:8888”, it doesn’t work. Where do I make a
> mistake?
>
> My platform is Windows 7 64bit and Using VS 2008. The PGM library download
> from http://miru.hk/openpgm/
>
>
>
> Sincerely
>
> Liwei Chour in OFFICe
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
_______________________________________________
zeromq-dev mailing list
zeromq-dev at lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev




More information about the zeromq-dev mailing list