Changeset 1184 for code/branches/network3/src/network
- Timestamp:
- Apr 24, 2008, 11:00:30 PM (17 years ago)
- Location:
- code/branches/network3/src/network
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network3/src/network/Client.cc
r1168 r1184 44 44 namespace network 45 45 { 46 Client* Client::_sClient = 0; 47 48 Client* Client::createSingleton(){ 49 if(!_sClient) 50 _sClient = new Client(); 51 return _sClient; 52 } 53 54 Client* Client::createSingleton(std::string address, int port){ 55 if(!_sClient) 56 _sClient = new Client(address, port); 57 return _sClient; 58 } 59 60 Client* Client::createSingleton(const char *address, int port){ 61 if(!_sClient) 62 _sClient = new Client(address, port); 63 return _sClient; 64 } 65 66 void Client::destroySingleton(){ 67 if(_sClient){ 68 delete _sClient; 69 _sClient = 0; 70 } 71 } 72 73 Client* Client::getSingleton(){ 74 return _sClient; 75 } 76 46 77 /** 47 78 * Constructor for the Client class … … 71 102 } 72 103 104 Client::~Client(){ 105 if(isConnected) 106 closeConnection(); 107 } 108 73 109 /** 74 110 * Establish the Connection to the Server -
code/branches/network3/src/network/Client.h
r1168 r1184 65 65 class _NetworkExport Client : PacketDecoder, public orxonox::Tickable{ 66 66 public: 67 Client(); 68 Client(std::string address, int port); 69 Client(const char *address, int port); 70 67 68 static Client* createSingleton(); 69 static Client* createSingleton(std::string address, int port); 70 static Client* createSingleton(const char *address, int port); 71 static void destroySingleton(); 72 static Client *getSingleton(); 73 71 74 bool establishConnection(); 72 75 bool closeConnection(); … … 84 87 85 88 private: 89 Client(); 90 Client(std::string address, int port); 91 Client(const char *address, int port); 92 ~Client(); 93 94 static Client* _sClient; 95 86 96 ClientConnection client_connection; 87 97 PacketGenerator pck_gen; -
code/branches/network3/src/network/Server.cc
r1175 r1184 143 143 updateGamestate(); 144 144 145 sleep(1); // TODO remove145 //sleep(1); // TODO remove 146 146 return; 147 147 }
Note: See TracChangeset
for help on using the changeset viewer.