Guest User

Untitled

a guest
Jul 6th, 2012
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. void loop(DB *db, void *socket) {
  2.   void *raw = NULL;
  3.   char *res = NULL;
  4.   zmq_msg_t request;
  5.   zmq_msg_t reply;
  6.    size_t len = 0;
  7.  
  8.   while(!quit) {
  9.     zmq_msg_init(&request);
  10.     zmq_recv(socket, &request, 0);
  11.  
  12.     <process request>
  13.  
  14.     zmq_msg_close(&request);
  15.     len = strlen(res) + 1;
  16.  
  17.     // Send reply back to client                                                
  18.     xsend(socket, len, res, 0);
  19.     free(res);
  20.   }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment