[zeromq-dev] Unable to run Weather update server (wuserver.c) example
Shaukat Mahmood Ahmad
write at sma.im
Sun Jun 16 11:12:31 CEST 2013
Hi,
I am unable to run Weather update server (wuserver.c) example due to
failed assertion at second bind request as following.
rc = zmq_bind (publisher, "ipc://weather.ipc");
assert (rc == 0);
The above assert fails as zmq_bind() returns -1.
Can anybody help me to resolve this error.
: Complete Code
#include "zhelpers.h"
int main ()
{
void *context = zmq_ctx_new();
void *publisher = zmq_socket(context, ZMQ_PUB);
int rc = zmq_bind(publisher, "tcp://*:5556");
assert (rc == 0);
rc = zmq_bind(publisher, "ipc://weather.ipc");
rc = zmq_bind (publisher, "ipc://weather.ipc");
assert (rc == 0);
srand ((unsigned) time(NULL));
while (1)
{
int zipcode, temperature, relhumidity;
char update[20];
zipcode = randof (100000);
temperature = randof (215) - 80;
relhumidity = randof (50) + 10;
sprintf (update, "%05d %d %d", zipcode, temperature, relhumidity);
s_send( publisher, update);
}
zmq_close (publisher);
zmq_ctx_destroy (context);
return 0;
}
More information about the zeromq-dev
mailing list