Advertisement
Guest User

Untitled

a guest
May 27th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1.         while (1) {
  2.             FD_ZERO(&rfds);
  3.             FD_ZERO(&wfds);
  4.             FD_SET(sfd, &rfds);
  5.             send_field(cl, pl_num);
  6.  
  7.             for (it = cl.begin(); it != cl.end(); ++it) {
  8.                 FD_SET(it->fd, &rfds);
  9.         /* wbuf - буфер на запись, msg - список сообщений */
  10.                 if (it->wbuf.get_len() > 0 || it->msg.size()) {
  11.                     FD_SET(it->fd, &wfds);
  12.                 }
  13.             }
  14.  
  15.             gettimeofday(&rt, NULL);
  16.             cur = rt;
  17.             dif = tact - cur;
  18.             if (dif < Time(0, 0)) {
  19.                 timeout = Time(0, 0);
  20.             } else {
  21.                 timeout = dif;
  22.             }
  23.  
  24.             res = select(FD_SETSIZE, &rfds, &wfds, NULL, &timeout);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement