Skip to content

Instantly share code, notes, and snippets.

@SavageMessiah
Created April 14, 2011 19:48
Show Gist options
  • Save SavageMessiah/920327 to your computer and use it in GitHub Desktop.
Save SavageMessiah/920327 to your computer and use it in GitHub Desktop.
ctrl-c test
#include <zmq.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
int main (void)
{
void *context = zmq_init (1);
// Socket to talk to clients
void *responder = zmq_socket (context, ZMQ_REP);
zmq_bind (responder, "tcp://*:5555");
while (1) {
// Wait for next request from client
zmq_msg_t request;
zmq_msg_init (&request);
zmq_recv (responder, &request, 0);
printf ("Received Hello\n");
zmq_msg_close (&request);
}
// We never get here but if we did, this would be how we end
zmq_close (responder);
zmq_term (context);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment