Changeset 9396 in orxonox.OLD for branches/proxy/src/lib/network/network_manager.cc
- Timestamp:
- Jul 23, 2006, 10:07:23 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/network/network_manager.cc
r9357 r9396 10 10 11 11 ### File Specific: 12 main-programmer: Patrick Boenzli 13 co-programmer: ...12 main-programmer: Patrick Boenzli (patrick@orxonox.ethz.ch) 13 co-programmer: Christoph Renner (rennerc@ee.ethz.ch) 14 14 */ 15 15 … … 98 98 99 99 100 101 /** 102 * creates a new NetworkStream of server type 103 * @param port: number of the TCP port 104 */ 105 int NetworkManager::createMasterServer(unsigned int port) 106 { 107 // init the proxy settings data do this before everything else is done here 108 NetworkSettings::getInstance()->loadData(); 109 110 // create the network stream 111 this->networkStream = new NetworkStream(NET_MASTER_SERVER); 112 this->networkStream->createServer( port); 113 114 // start the network game manager 115 this->networkStream->createNetworkGameManager(); 116 117 PRINTF(0)("Created Network Master Server\n"); 118 SDL_Delay(20); 119 return 1; 120 } 121 122 /** 123 * creates a new network stream of proxy server type 124 * @param port: number of the TCP port 125 */ 126 int NetworkManager::createProxyServer(unsigned int port) 127 { 128 // init the proxy settings data do this before everything else is done here 129 NetworkSettings::getInstance()->loadData(); 130 131 // create the network stream 132 this->networkStream = new NetworkStream(NET_PROXY_SERVER_ACTIVE); 133 this->networkStream->createServer( port); 134 // and connect to the master server for synchronization 135 // this->networkStream->connectToMasterServer(NetworkSettings::getInstance()->getMasterAddr()); 136 // and to the other proxy servers 137 138 139 140 // start the network game manager 141 this->networkStream->createNetworkGameManager(); 142 143 144 PRINTF(0)("Created Network Proxy Server\n"); 145 SDL_Delay(20); 146 return 1; 147 } 148 149 100 150 /** 101 151 * creates a connection from one object to a host 102 152 * @param hostName: the name of the destination host 103 153 */ 104 int NetworkManager::establishConnection(const std::string & name, unsigned int port) 105 { 106 this->networkStream = new NetworkStream( name, port ); 107 SharedNetworkData::getInstance()->setDefaultSyncStream(this->networkStream); 154 int NetworkManager::createClient(const std::string & name, unsigned int port) 155 { 156 // create the network stream 157 this->networkStream = new NetworkStream(NET_CLIENT); 158 // connect to the master server, if a redirection should occure, this is handled in the NetworkStream itself 159 this->networkStream->connectToMasterServer( name, port); 160 161 // and start the handshake 108 162 this->networkStream->startHandshake(); 163 164 PRINTF(0)("Created Network Client"); 109 165 return 1; 110 166 } … … 112 168 113 169 /** 114 * creates a new NetworkStream of server type 115 * @param port: number of the TCP port 116 */ 117 int NetworkManager::createServer(unsigned int port) 118 { 119 SharedNetworkData::getInstance()->setHostID(0); 120 SharedNetworkData::getInstance()->setNodeType(NET_MASTER_SERVER); 121 this->networkStream = new NetworkStream(port); 122 SharedNetworkData::getInstance()->setDefaultSyncStream(this->networkStream); 123 this->networkStream->createNetworkGameManager(); 124 PRINTF(0)("CREATE SERVER\n"); 125 SDL_Delay(20); 126 return 1; 127 } 128 129 170 * connects a synchronizeable to the network stream 171 * @param sync: synchronizeable to connect 172 */ 130 173 void NetworkManager::connectSynchronizeable(Synchronizeable& sync) 131 174 { … … 144 187 if( likely(this->elapsedTime < 1.0f / NETWORK_FREQUENCY)) 145 188 return; 189 146 190 this->elapsedTime = 0.0f; 147 191 148 if ( networkStream )192 if ( this->networkStream ) 149 193 networkStream->processData(); 150 194
Note: See TracChangeset
for help on using the changeset viewer.