Networking Reference
In-Depth Information
zmsg
This is used to work with multi-part messages. Its sample usage is as follows:
/*
Send "hello" in multi-parts using zmsg.
server.c
*/
#include "czmq.h"
int main (int argc, char const *argv[]) {
zctx_t* context = zctx_new();
void* socket = zsocket_new(context, ZMQ_REP);
zsocket_bind(socket, "tcp://*:5050");
printf("Starting server...\n");
for(;;) {
zmsg_t* msg = zmsg_new();
zmsg_addmem(msg, "h", 1);
zmsg_addmem(msg, "e", 1);
zmsg_addmem(msg, "l", 1);
zmsg_addmem(msg, "l", 1);
zmsg_addmem(msg, "o", 1);
zmsg_send(&msg, socket);
zmsg_destroy(&msg);
}
zsocket_destroy(context, socket);
zctx_destroy(&context);
return 0;
}
 
Search MirCeyron ::




Custom Search