[zeromq-dev] why zmq_send didn't block in ZMQ_REQ&ZMQ_REP model?
Chenglong Chen
chenchenglong112 at gmail.com
Wed Feb 22 07:51:23 CET 2012
#include <zmq.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
int main (int argc,char **argv){
void *context = zmq_init (1);
void *requester = zmq_socket (context, ZMQ_REQ);
int error = zmq_connect (requester, "tcp://localhost:5555");
printf("%d\n",error);
zmq_msg_t request={0};
zmq_msg_init_size (&request, strlen(argv[1]));
memcpy (zmq_msg_data (&request), argv[1], strlen(argv[1]));
printf ("Sending Message");
zmq_send (requester, &request, 0);
printf ("Send Message Done.");
int error1 = zmq_send(requester,&request,0);
printf("%d",error1);
zmq_msg_close (&request);
zmq_close (requester);
return 0;
}
hi,all,in this scene.
i did't start the service,and i saw the doc.
When a ZMQ_REQ socket enters an exceptional state due to having reached the
high water mark for all services, or if there are no services at all, then
any zmq_send(3) operations on the socket shall block until the exceptional
state ends or at least one service becomes available for sending; messages
are not discarded.
so,why the client didn't block at the zmq_send function?
3ks:)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120222/e5ebd57d/attachment.htm>
More information about the zeromq-dev
mailing list