Networking Reference
In-Depth Information
int conn = zmq_bind(publisher, "tcp://*:4040");
conn = zmq_bind(publisher, "ipc://stock.ipc");
const char* companies[3] = {"Company1", "Company10",
for(;;) {
int price = count % 17;
int which_company = count % 3;
int index = strlen(companies[which_company]);
char update[64];
sprintf(update, "%s| %d", companies[which_company], price);
zmq_msg_t message;
zmq_msg_init_size(&message, index);
memcpy(zmq_msg_data(&message), update, index);
zmq_msg_send(&message, publisher, 0);
return 0;
And the following is our updated subscriber code to filter results using the delimiter
we use in our publisher code:
// Stock Market Client
// Connects SUB socket to tcp://localhost:4040
// Collects stock exchange values
#include <stdlib.h>
#include <string.h>
#include "zmq.h"
int main (int argc, char const *argv[]) {
Search MirCeyron ::

Custom Search