Changeset 9463 in orxonox.OLD
- Timestamp:
- Jul 25, 2006, 7:29:31 PM (18 years ago)
- Location:
- branches/proxy/src/lib/network
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/network/network_manager.cc
r9458 r9463 101 101 /** 102 102 * creates a new NetworkStream of server type 103 * @param port: number of the TCP port 103 * @param clientPort: number of the TCP/UDP port for client connections 104 * @param proxyPort: number of the TCP/UDP port for proxy connections 104 105 */ 105 106 int NetworkManager::createMasterServer(unsigned int port) … … 110 111 // create the network stream 111 112 this->networkStream = new NetworkStream(NET_MASTER_SERVER); 112 this->networkStream->createServer( port );113 this->networkStream->createServer( port, port + 1); 113 114 114 115 // start the network game manager -
branches/proxy/src/lib/network/network_stream.cc
r9462 r9463 112 112 /* set the class id for the base object */ 113 113 this->setClassID(CL_NETWORK_STREAM, "NetworkStream"); 114 this->serverSocket = NULL; 114 this->clientSocket = NULL; 115 this->proxySocket = NULL; 115 116 this->networkGameManager = NULL; 116 117 this->networkMonitor = NULL; … … 140 141 NetworkStream::~NetworkStream() 141 142 { 142 if ( this->serverSocket ) 143 { 144 serverSocket->close(); 145 delete serverSocket; 146 serverSocket = NULL; 143 if ( this->clientSocket ) 144 { 145 clientSocket->close(); 146 delete clientSocket; 147 clientSocket = NULL; 148 } 149 if ( this->proxySocket) 150 { 151 proxySocket->close(); 152 delete proxySocket; 153 proxySocket = NULL; 147 154 } 148 155 for ( PeerList::iterator i = peers.begin(); i!=peers.end(); i++) … … 219 226 * @param port: interface port for all clients 220 227 */ 221 void NetworkStream::createServer(int port) 222 { 223 this->serverSocket = new UdpServerSocket(port); 228 void NetworkStream::createServer(int clientPort, int proxyPort) 229 { 230 this->proxySocket = new UdpServerSocket(clientPort); 231 this->clientSocket= new UdpServerSocket(proxyPort); 224 232 } 225 233 … … 308 316 { 309 317 // execute everytthing the master server shoudl do 310 if ( serverSocket )311 serverSocket->update();318 if ( clientSocket ) 319 clientSocket->update(); 312 320 313 321 this->updateConnectionList(); … … 316 324 { 317 325 // execute everything the proxy server should do 318 if ( serverSocket )319 serverSocket->update();326 if ( clientSocket ) 327 clientSocket->update(); 320 328 321 329 this->updateConnectionList(); … … 360 368 //check for new connections 361 369 362 NetworkSocket* tempNetworkSocket = serverSocket->getNewSocket();370 NetworkSocket* tempNetworkSocket = clientSocket->getNewSocket(); 363 371 364 372 // we got new network node -
branches/proxy/src/lib/network/network_stream.h
r9459 r9463 43 43 void connectToMasterServer(std::string host, int port); 44 44 void connectToProxyServer(int proxyId, std::string host, int port); 45 void createServer(int port);45 void createServer(int clientPort, int proxyPort); 46 46 47 47 void createNetworkGameManager(); … … 110 110 NetworkMonitor* networkMonitor; //!< the network monitor 111 111 NetworkGameManager* networkGameManager; //!< reference to the network game manager 112 ServerSocket* serverSocket; //!< the listening socket of the server 112 ServerSocket* clientSocket; //!< the listening socket of the server 113 ServerSocket* proxySocket; //!< socket for proxy connections 113 114 114 115 std::map<int,int> oldSynchronizeables; //!< used to save recently deleted sync ids to not recreate them -
branches/proxy/src/lib/network/udp_server_socket.cc
r9462 r9463 77 77 78 78 /** 79 * get newly connected clientsocket. note79 * get newly connected socket. note 80 80 * @return new socket or NULL if no new socket exists 81 *82 * only clients connect to this socket83 81 */ 84 82 NetworkSocket * UdpServerSocket::getNewSocket( void ) … … 95 93 return result; 96 94 } 97 98 99 /**100 * get newly connected proxy socket. note101 * @return new socket or NULL if no new socket exists102 *103 * only proxy servers connect to this socket104 */105 NetworkSocket * UdpServerSocket::getNewProxySocket( void )106 {107 NetworkSocket * result = NULL;108 109 if ( newSocketList.size() > 0 )110 {111 result = newSocketList.front();112 113 newSocketList.pop_front();114 }115 116 return result;117 }118 119 95 120 96
Note: See TracChangeset
for help on using the changeset viewer.