Server.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #pragma once
  2. #include <Server.h>
  3. #include <Thread.h>
  4. #include <Datei.h>
  5. #include <Text.h>
  6. #include <InitDatei.h>
  7. #include "Game.h"
  8. using namespace Framework;
  9. using namespace Network;
  10. class FCKlient;
  11. class GameClient;
  12. class FactoryCraftServer : virtual public ReferenceCounter
  13. {
  14. private:
  15. SSLServer* server;
  16. InitDatei* ini;
  17. CRITICAL_SECTION cs;
  18. RCArray< FCKlient >* klients;
  19. Game* game;
  20. int id;
  21. int empfangen;
  22. int gesendet;
  23. public:
  24. // Konstruktor
  25. FactoryCraftServer( InitDatei* zIni );
  26. // Destruktor
  27. virtual ~FactoryCraftServer();
  28. // nicht constant
  29. void run();
  30. void close();
  31. bool absturzKlient( int accountId );
  32. bool removeKlient( FCKlient* zKlient );
  33. void addGesendet( int bytes );
  34. void addEmpfangen( int bytes );
  35. bool hatClients() const;
  36. Game* zGame() const;
  37. };
  38. class FCKlient : public Thread
  39. {
  40. private:
  41. SSLSKlient* klient;
  42. unsigned int accountId;
  43. FactoryCraftServer* ls;
  44. GameClient* zGameClient;
  45. NetworkReader* reader;
  46. NetworkWriter* writer;
  47. public:
  48. // Konstruktor
  49. FCKlient( SSLSKlient* klient, FactoryCraftServer* ls );
  50. // Destruktor
  51. virtual ~FCKlient();
  52. // nicht constant
  53. void absturz();
  54. void thread();
  55. // constant
  56. int getAccountId() const;
  57. SSLSKlient* zClient() const;
  58. NetworkWriter* zWriter() const;
  59. };