Skip to content

Instantly share code, notes, and snippets.

@ianbarber
Created February 8, 2011 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ianbarber/816533 to your computer and use it in GitHub Desktop.
Save ianbarber/816533 to your computer and use it in GitHub Desktop.
EPGM SUB
#include <zmq.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdint.h>
int main () {
void *context = zmq_init (1);
printf("Creating Sockets \n");
int64_t rate = 1000;
printf("Connecting Sub \n");
void *sub = zmq_socket (context, ZMQ_SUB);
zmq_setsockopt( sub, ZMQ_RATE, &rate, sizeof(rate));
zmq_setsockopt( sub, ZMQ_SUBSCRIBE, "", 0);
zmq_connect (sub, "epgm://eth0;239.192.0.1:7601");
printf("Prep Message \n");
zmq_msg_t message;
zmq_msg_init(&message);
printf("recving \n");
zmq_recv(sub, &message, 0);
char *data = zmq_msg_data(&message);
printf("%s \n", data);
zmq_term (context);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment