ClientConnection.h
Go to the documentation of this file.00001 00010 #ifndef __ClientConnection_H__ 00011 #define __ClientConnection_H__ 00012 00013 // Includes 00014 00015 // Forward declares 00016 class StaticBuffer; 00017 class DynamicBuffer; 00018 class Platform_Network_Client; 00019 00020 // ClientConnection 00021 class ClientConnection 00022 { 00023 public: 00027 ClientConnection(); 00028 00029 00033 virtual ~ClientConnection(); 00034 00035 00040 void Connect( 00041 const char* address, 00042 int port, 00043 bool useTCP, 00044 bool useUDP 00045 ); 00046 00047 00052 void ConnectSP(); 00053 00054 00063 void ConnectHTTP( 00064 const char* address, 00065 int port, 00066 const char* resource = "/" 00067 00068 ); 00069 00073 void Disconnect(); 00074 00075 00079 void Update(float deltaTime); 00080 00081 00088 void TransmitTCP( 00089 const StaticBuffer& data 00090 ); 00091 00092 00099 void TransmitUDP( 00100 const StaticBuffer& data 00101 ); 00102 00108 virtual void OnConnected() = 0; 00109 00110 00116 virtual void OnDisconnected() = 0; 00117 00118 00124 virtual void OnReceiveData( 00125 const StaticBuffer& data 00126 ) = 0; 00127 00128 00129 private: 00130 bool localCommunications_; 00131 bool localCommunications_OnConnected_Done_; 00132 Platform_Network_Client* connectionTCP_; 00133 Platform_Network_Client* connectionUDP_; 00134 Platform_Network_Client* connectionHTTP_; 00135 00136 private: 00137 friend class ServerConnection; 00138 static DynamicBuffer* localClientCommunicationsBuffer_; 00139 static int localClientCommunicationsBuffer_referenceCount_; 00140 }; 00141 00142 00143 #endif /* __ClientConnection_H__ */ 00144
Reproduction/republishing of any material on this site without permission is strictly prohibited.
