[zeromq-dev] Invalid message
... ...
bersac_1 at hotmail.fr
Mon Jul 15 12:24:16 CEST 2013
Hi,
I am currently trying to develop a server using 0mq. The problem is that I keep having the same error message (retrieved using the zmq_strerror function) while sending the message :Resource temporarily unavailable.This correspond to the following error message number : eagain and approximatively mean : Non-blocking mode was requested and the message cannot be sent at the moment.
My code is the following :
int main () { // Prepare our context and publisher zmq::context_t context (1); zmq::socket_t publisher (context, ZMQ_PUB); publisher.bind("ipc://weather.ipc");
while (1) { int zipcode, temperature, relhumidity;
// Get values that will fool the boss zipcode = within (100000); temperature = within (215) - 80; relhumidity = within (50) + 10;
// Send message to all subscribers zmq::message_t message(20); snprintf ((char *) message.data(), 20 , "%05d %d %d", zipcode, temperature, relhumidity); bool b = publisher.send(message); if(b){ printf("%s.\n", zmq_strerror(errno)); } sleep(1); } return 0;}
This code is highly inspired by this example : http://zguide.zeromq.org/cpp:wuserverCould you help me find the source of my problem ?
Cordially,Guillaume Bersac237bis rue de Pessac33000 Bordeaux06.65.30.89.43
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130715/96540586/attachment.htm>
More information about the zeromq-dev
mailing list