Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include "server.h"
  2. #include "client.h"
  3.  
  4. #include <iostream>
  5. #include <exception>
  6.  
  7. int main()
  8. {
  9.     Server *s = new Server;
  10.     s->setAcceptConnections(true);
  11.     s->start();
  12.     while (s->hasAccept()) {
  13.         for (ClientsMap::const_iterator it = s->begin(); it != s->end(); ++it) {
  14.             try
  15.             {
  16.                 printf("%s\n", it->second->receive().c_str());
  17.             }
  18.             catch(std::exception const & e)
  19.             {
  20.                 std::cout << "Exception: " << e.what() << std::endl;
  21.                 system("pause");
  22.             }
  23.         }
  24.     }
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement