Skip to content

Instantly share code, notes, and snippets.

@edmt
Created March 7, 2014 15:28
Show Gist options
  • Select an option

  • Save edmt/9413522 to your computer and use it in GitHub Desktop.

Select an option

Save edmt/9413522 to your computer and use it in GitHub Desktop.
Hello World Server in C (example)
#include <zmq.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
int main (void)
{
void *context = zmq_ctx_new();
void *responder = zmq_socket(context, ZMQ_REP);
int rc = zmq_bind(responder, "tcp://*:5555");
assert (rc == 0);
while (1) {
char buffer [10];
zmq_recv(responder, buffer, 10, 0);
printf ("Received Hello\n");
zmq_send(responder, "World", 5, 0);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment