Networking Reference
In-Depth Information
The lag option can only be one value, which is ZMQ_DONTWAIT . If ZMQ_DONTWAIT is
specified, then the operation is performed in the non-blocking mode. If the message
is successfully received, it ( zmq_msg_recv(3) ) returns the size of the message in
bytes; otherwise it returns -1 and the error message lag.
The publish-subscribe pattern is asynchronous and sending a message to a SUB socket
causes an error. You could call zmq_msg_send(3) to send messages whenever you
want but you should never call zmq_msg_recv(3) on a PUB socket.
The following is the sample output of the client code:
Company2 570
Company2 878
Company2 981
Company2 783
Company1 855
Company1 524
Company2 639
Company1 984
Company1 158
Company2 145
The publisher will always send messages even if there is no subscriber. You could
try it and see for yourself. You would see that the publisher sends something like
the following:
Sending... Company2 36
Sending... Company2 215
Sending... Company2 712
Sending... Company2 924
Sending... Company2 721
Sending... Company1 668
Sending... Company2 83
Sending... Company2 209
Sending... Company1 450
Sending... Company1 940
Sending... Company1 57
Sending... Company2 3
Sending... Company1 100
Sending... Company2 947
 
Search MirCeyron ::




Custom Search