2012-03-18 21:13:17 +00:00
|
|
|
#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",
|
2012-03-18 21:13:17 +00:00
|
|
|
(int) (s_clock() - start_time));
|
|
|
|
|
|
|
|
zmq_close(receiver);
|
|
|
|
zmq_term(context);
|
|
|
|
return 0;
|
|
|
|
}
|