Server.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 klientAnzahl;
  21. int id;
  22. int empfangen;
  23. int gesendet;
  24. public:
  25. // Konstruktor
  26. FactoryCraftServer( InitDatei *zIni );
  27. // Destruktor
  28. virtual ~FactoryCraftServer();
  29. // nicht constant
  30. void run();
  31. void close();
  32. bool absturzKlient( int accountId );
  33. bool removeKlient( FCKlient *zKlient );
  34. void addGesendet( int bytes );
  35. void addEmpfangen( int bytes );
  36. bool hatClients() const;
  37. Game *zGame() const;
  38. };
  39. class FCKlient : public Thread
  40. {
  41. private:
  42. SSLSKlient *klient;
  43. unsigned int accountId;
  44. FactoryCraftServer *ls;
  45. GameClient *zGameClient;
  46. NetworkReader *reader;
  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. };