Networking Reference
In-Depth Information
printf("%s\n", value);
free(value);
}
zmq_close(subscriber);
zmq_ctx_destroy(context);
return 0;
}
The output would be something like the following:
Company1 575
Company1 504
Company1 513
Company1 584
Company1 444
Company1 1010
Company1 524
Company1 963
Company1 929
Company1 718
Filtering out messages
Our basic stock exchange application sends messages to subscribers. It seems
everything has gone as expected, right? Unfortunately, no.
ZeroMQ matches the subscriber strings with prefix matching, which means
ZeroMQ will return Company1 , Company10 , and Company101 even if you look
for Company1 alone.
Let's change our publisher code to the following:
//
// Stock Market Server
// Binds PUB socket to tcp://*:4040
// Publishes random stock values of random companies
//
#include <string.h>
#include "zmq.h"
 
Search MirCeyron ::




Custom Search