JaviGr

Untitled

Jul 3rd, 2018
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class ClientsTread
  2. {
  3. public:
  4.     ClientsTread(){ _clients.clear(); }
  5.     ~ClientsTread()
  6.     {
  7.         for(std::set<ClientSocket*>::iterator it = _clients.begin(); it != _clients.end(); it++)
  8.         {
  9.             if ((*it)->_socket)
  10.             {
  11.                 shutdown((*it)->_socket, 2);
  12.                 close((*it)->_socket);
  13.             }
  14.         }
  15.     }
  16.     void add(ClientSocket *cs)
  17.     {
  18.         _clients.insert(cs);
  19.         if (DEBUG)
  20.             std::cout << "ClientsTread add:" << cs->_socket << std::endl;
  21.     }
  22. private:
  23.     std::set<ClientSocket*> _clients;
  24. } *_clientsthread;
Add Comment
Please, Sign In to add comment