FactoryClient.h 865 B

123456789101112131415161718192021222324252627282930313233
  1. #pragma once
  2. #include <Network.h>
  3. #include <Klient.h>
  4. #include <Text.h>
  5. #include <Thread.h>
  6. #include <Critical.h>
  7. class FactoryClient : public Framework::ReferenceCounter
  8. {
  9. private:
  10. Network::SSLKlient* client;
  11. Network::Klient* foreground;
  12. Network::Klient* background;
  13. Network::NetworkReader* foregroundReader;
  14. Network::NetworkReader* backgroundReader;
  15. Framework::Critical cs;
  16. int bgReaderUsage;
  17. int fgReaderUsage;
  18. void disconnect();
  19. public:
  20. FactoryClient();
  21. ~FactoryClient();
  22. bool connect(Text ip, short port, int accountId, Text secret);
  23. Network::NetworkReader* getNextForegroundMessage();
  24. Network::NetworkReader* getNextBackgroundMessage();
  25. void endMessageReading(bool bg);
  26. void sendPlayerAction(char* data, unsigned short length);
  27. void entityAPIRequest(int entityId, char* message, unsigned short length);
  28. };