[zeromq-dev] Assert on pgm_getsockopt (Win7 x64, ZMQ 2.1.7, OpenPGM 5.1.116 )
Scott Asher
scottpriceasher at gmail.com
Wed Aug 17 23:08:45 CEST 2011
Below is a (pretty) minimal test case in C++. It carries 2 threads (using
boost::thread), but hopefully this is OK. If not, I can cut it down
further. I will attach it to a new issue in JIRA since I am not sure this
is quite the same issue as earlier, although I would describe it as broadly
a Win64 OpenPGM/0MQ issue.
If you run the below with #define USE_PGM, you will get bad behavior.
If you run the below without this define (i.e. using TCP), it is fine.
Also, if you just comment out the two ZMQ_SENDMORE sends, and simply receive
1 int using PGM, then it also works fine, suggesting something is wrong with
mutlipart messages.
Scott
========================================================================
#include <ZMQ/zmq.hpp>
#include <string>
#include <boost/thread.hpp>
//#define USE_PGM
zmq::context_t cxt(1);
void worker(void) {
zmq::socket_t pub(cxt, ZMQ_PUB);
_int64 Rate = 10000;
_int64 LB = 0;
#ifdef USE_PGM
pub.setsockopt(ZMQ_RATE, &Rate, sizeof(Rate));
pub.setsockopt(ZMQ_MCAST_LOOP, &LB, sizeof(LB));
std::string address = "epgm://10.22.33.106;
236.0.0.80:5561";
#else
std::string address = "tcp://10.22.33.106:60013";
#endif
try { pub.bind(address.c_str());
}
catch ( zmq::error_t err ) { printf("Pub bind error: [ %s ]\n",
err.what()); }
Sleep(2000);
int IntToSend = 1024;
zmq::message_t msg(sizeof(int));
memcpy((void*)msg.data(), (const void*)&IntToSend, sizeof(IntToSend));
pub.send(msg, ZMQ_SNDMORE);
pub.send(msg, ZMQ_SNDMORE);
pub.send(msg, 0);
}
int main(void) {
boost::thread th(worker);
zmq::socket_t sub(cxt, ZMQ_SUB);
sub.setsockopt(ZMQ_SUBSCRIBE, "", 0);
#ifdef USE_PGM
std::string address = "epgm://10.22.33.106;
236.0.0.80:5561";
#else
std::string address = "tcp://10.22.33.106:60013";
#endif
try { sub.connect(address.c_str());
}
catch ( zmq::error_t err ) { printf("Sub connect error: [ %s
]\n", err.what()); }
Sleep(2000);
int test;
zmq::message_t msg;
sub.recv(&msg);
memcpy((void *)&test, (const void *)msg.data(), sizeof(int));
printf("TEST: [ %d ]\n", test);
sub.recv(&msg);
memcpy((void *)&test, (const void *)msg.data(), sizeof(int));
printf("TEST: [ %d ]\n", test);
sub.recv(&msg);
memcpy((void *)&test, (const void *)msg.data(), sizeof(int));
printf("TEST: [ %d ]\n", test);
char tmp[10];
gets(tmp);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110817/c67bb81d/attachment.htm>
More information about the zeromq-dev
mailing list