Networking Reference
In-Depth Information
printf("Starting server...\n");
zloop_t* loop = zloop_new();
zloop_set_verbose(loop, 1);
zloop_timer(loop, 10000, 1, do_send, NULL);
zmq_pollitem_t poll = {socket, 0, ZMQ_POLLIN};
zloop_poller(loop, &poll, do_something, socket);
zloop_start(loop);
zloop_destroy(&loop);
zsocket_destroy(context, socket);
zctx_destroy(&context);
return 0;
}
And the following is the client code:
#include "czmq.h"
#include <signal.h>
int main (int argc, char const *argv[]) {
zctx_t* context = zctx_new();
void* request = zsocket_new(context, ZMQ_PUSH);
signal(SIGINT, exit);
printf("Starting client...\n");
zsocket_connect(request, "tcp://localhost:5050");
int i = 0;
for(;;) {
zstr_send(request, "hello");
printf("Pushing Hello\n");
}
zsocket_destroy(context, request);
zctx_destroy(&context);
return 0;
}
 
Search MirCeyron ::




Custom Search