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
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev