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.

Revisions

  1. edmt created this gist Mar 7, 2014.
    21 changes: 21 additions & 0 deletions server.c
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    #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;
    }