Hi,everyone! 
 I am a new learner for zmq,I am totally confused with the different kinds of 
messages and the methods of receiving or sending message.In the guide book,the 
methods changed with every several examples.I can not fully understand the 
difference between these methods.Here is one test example:
void *context = zmq_ctx_new ();
 void *server = zmq_socket (context, ZMQ_ROUTER);
 zmq_bind (server, "tcp://192.168.199.152:5671");
void *client = zmq_socket (context, ZMQ_DEALER);
zmq_connect (client, "tcp://192.168.199.152:5671");
s_send(client,"hello");
s_dump(server);‍

I did not call s_set_id() method ,But why did i receive an identity from 
s_dump()????
Here is another test example.
void *context = zmq_ctx_new ();
 void *server = zmq_socket (context, ZMQ_ROUTER);
 zmq_bind (server, "tcp://192.168.199.152:5671");
void *client = zmq_socket (context, ZMQ_DEALER);
zmq_connect (client, "tcp://192.168.199.152:5671");
s_send(client,"hello");‍

s_recv(server);
s_recv(server);
Yes, I call s_recv() for two times.For the first time,there is a null 
string,for the second time,I get "hello".So how the null string can 
come???According to the Guide book, The REQ/REP socket will insert a null 
delimiter into message before data by default.But here i am using ROUTER/DEALER 
and i did not add a null delimiter.So where did the null delimiter come 
from??Actually,I thought i should receive an identity randomly generated by 
ROUTER socket  ‍for the specific connection for the first receive.But it turns 
out to be a NULL string.What makes the result so different between the above 
two examples???Who can explain all these weird things for me ???Thanks so 
much.Cause this reallly drives me creazy especially when i learn 
CZMQ!!!!!(Another binding for zmq again!Oh god!)‍
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to