box-o-sand/zeromq/tasksink.c

33 lines
603 B
C
Raw Normal View History

#include "zhelpers.h"
int main(void)
{
void *context = zmq_init(1);
void *receiver = zmq_socket(context, ZMQ_PULL);
zmq_bind(receiver, "tcp://*:5558");
char *string = s_recv(receiver);
free(string);
int64_t start_time = s_clock();
int task_nbr;
for (task_nbr = 0; task_nbr < 100; task_nbr++) {
char *string = s_recv(receiver);
free(string);
if ((task_nbr / 10) * 10 == task_nbr) {
printf(":");
} else {
printf(".");
}
fflush(stdout);
}
2012-03-18 21:15:21 +00:00
printf("\nTotal elapsed time: %d msec\n",
(int) (s_clock() - start_time));
zmq_close(receiver);
zmq_term(context);
return 0;
}