Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * test_zmq_server.c
- *
- * Created on: Jul 8, 2013
- * Author: melchiore
- */
- #include <stdlib.h>
- #include <assert.h>
- #include "czmq.h"
- int main(void)
- {
- zctx_t * ctx = zctx_new();
- void * s = zsocket_new(ctx, ZMQ_REP);
- int rc = zsocket_bind(s, "tcp://127.0.0.1:8000");
- assert(0 < rc);
- zsocket_poll(s, -1);
- zmsg_t * zmsg = zmsg_recv(s);
- zmsg_destroy(&zmsg);
- zmsg = zmsg_new();
- // zframe_t * zframe = zframe_new(NULL, NULL);
- // zmsg_add(zmsg, zframe);
- rc = zmsg_send(&zmsg, s);
- assert(0 == rc);
- zctx_destroy(&ctx);
- return EXIT_SUCCESS;
- }
- /*
- * test_zmq_client.c
- *
- * Created on: Jul 8, 2013
- * Author: melchiore
- */
- #include <stdlib.h>
- #include <assert.h>
- #include "czmq.h"
- int main(void)
- {
- zctx_t * ctx = zctx_new();
- void * s = zsocket_new(ctx, ZMQ_REQ);
- zsocket_connect(s, "tcp://127.0.0.1:8000");
- zmsg_t * zmsg = zmsg_new();
- // zframe_t * zframe = zframe_new(NULL, NULL);
- // zmsg_add(zmsg, zframe);
- int rc = zmsg_send(&zmsg, s);
- assert(0 == rc);
- zsocket_poll(s, -1);
- zmsg = zmsg_recv(s);
- zmsg_destroy(&zmsg);
- zctx_destroy(&ctx);
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment