TDME2  1.9.200
ApplicationServerClient.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include <vector>
5 
6 #include <tdme/tdme.h>
14 
15 using std::string;
16 using std::vector;
17 
25 
26 /**
27  * Application server client
28  */
30  friend class WSServer;
31 
32 public:
33  // forbid class copy
35 
36  /**
37  * Public constructor
38  * @param clientId client id
39  * @param ip ip
40  * @param port port
41  */
42  ApplicationServerClient(const uint32_t clientId, const string& ip, const unsigned int port);
43 
44  /**
45  * @return incoming network packets mutex
46  */
48 
49  /**
50  * @return incoming network packets
51  */
52  vector<LogicNetworkPacket>& getNetworkPackets();
53 
54 protected:
55  /**
56  * Destructor
57  */
58  virtual ~ApplicationServerClient();
59 
60  /**
61  * On request
62  * @param packet packet
63  * @param messageId message id
64  * @param retries retries
65  * @throws Exception
66  */
67  void onRequest(const UDPPacket* packet, const uint32_t messageId, const uint8_t retries);
68 
69  /**
70  * On init
71  * @throws Exception
72  */
73  virtual void onInit();
74 
75  /**
76  * On close
77  * @throws Exception
78  */
79  virtual void onClose();
80 
81  /**
82  * On custom
83  * @throws Exception
84  */
85  virtual void onCustom(const string& type);
86 
87 private:
89  vector<LogicNetworkPacket> networkPackets;
90 };
ApplicationServerClient(const uint32_t clientId, const string &ip, const unsigned int port)
Public constructor.
virtual void onCustom(const string &type)
On custom.
void onRequest(const UDPPacket *packet, const uint32_t messageId, const uint8_t retries)
On request.
Base class for network UDP server clients.
Base class for network UDP servers.
Definition: UDPServer.h:42
Mutex implementation.
Definition: Mutex.h:19
std::exception Exception
Exception base class.
Definition: Exception.h:18
#define FORBID_CLASS_COPY(CLASS)
Definition: tdme.h:6