void *sub = zmq_socket(context,ZMQ_SUB) not
void *sub = zmq_socket(context,ZMQ_SUBSCRIBE) On Sat, Feb 16, 2013 at 10:33 PM, Min <[email protected]> wrote: > Hi > > You need to set socket options before connect. > > Thanks > Min > > 2013년 2월 17일 일요일에 suraj nellikar님이 작성: > > Hi, >> I am using zmq 3.2 library on Ubuntu (32 bit machine). I am trying to run >> a test PUB-SUB model but the client is failing to set the sockopt to >> ZMQ_SUBSCRIBE. Any idea what am I doing wrong here? >> >> Here's the snippet of the code. >> main() { >> void *context = zmq_ctx_new(); >> void *req = zmq_socket(context,ZMQ_REQ); >> void *sub = zmq_socket(context,ZMQ_SUBSCRIBE); >> >> int rc = zmq_connect(req,"tcp://127.0.0.1:5555"); >> printf("req connect, rc = %d\n",rc); >> rc = zmq_connect(sub,"tcp://192.168.72.130:6666"); >> printf("sub connect, rc = %d\n",rc); >> uint64_t affinity = 1; >> rc = zmq_setsockopt (sub, ZMQ_AFFINITY, &affinity, sizeof affinity); >> //This works only when I use uint64_t for affinity. It fails for int. >> printf("setsockopt, rc = %d, errno = %s\n",rc,strerror(errno)); >> rc = zmq_setsockopt(sub,ZMQ_SUBSCRIBE,"",0); >> //This always fails! rc is always -1 >> printf("setsockopt, ZMQ_SUBSCRIBE = %d,rc = %d, errno = >> %s\n",ZMQ_SUBSCRIBE,rc,strerror(errno)); >> >> Thanks. >> > > _______________________________________________ > zeromq-dev mailing list > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev > >
_______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
