Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9463 in orxonox.OLD for branches


Ignore:
Timestamp:
Jul 25, 2006, 7:29:31 PM (18 years ago)
Author:
patrick
Message:

the proxy network interface is started

Location:
branches/proxy/src/lib/network
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/lib/network/network_manager.cc

    r9458 r9463  
    101101/**
    102102 *  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
    104105 */
    105106int NetworkManager::createMasterServer(unsigned int port)
     
    110111  // create the network stream
    111112  this->networkStream = new NetworkStream(NET_MASTER_SERVER);
    112   this->networkStream->createServer( port);
     113  this->networkStream->createServer( port, port + 1);
    113114
    114115  // start the network game manager
  • branches/proxy/src/lib/network/network_stream.cc

    r9462 r9463  
    112112  /* set the class id for the base object */
    113113  this->setClassID(CL_NETWORK_STREAM, "NetworkStream");
    114   this->serverSocket = NULL;
     114  this->clientSocket = NULL;
     115  this->proxySocket = NULL;
    115116  this->networkGameManager = NULL;
    116117  this->networkMonitor = NULL;
     
    140141NetworkStream::~NetworkStream()
    141142{
    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;
    147154  }
    148155  for ( PeerList::iterator i = peers.begin(); i!=peers.end(); i++)
     
    219226 * @param port: interface port for all clients
    220227 */
    221 void NetworkStream::createServer(int port)
    222 {
    223   this->serverSocket = new UdpServerSocket(port);
     228void NetworkStream::createServer(int clientPort, int proxyPort)
     229{
     230  this->proxySocket = new UdpServerSocket(clientPort);
     231  this->clientSocket= new UdpServerSocket(proxyPort);
    224232}
    225233
     
    308316  {
    309317    // execute everytthing the master server shoudl do
    310     if ( serverSocket )
    311       serverSocket->update();
     318    if ( clientSocket )
     319      clientSocket->update();
    312320
    313321    this->updateConnectionList();
     
    316324  {
    317325    // execute everything the proxy server should do
    318     if ( serverSocket )
    319       serverSocket->update();
     326    if ( clientSocket )
     327      clientSocket->update();
    320328
    321329    this->updateConnectionList();
     
    360368  //check for new connections
    361369
    362   NetworkSocket* tempNetworkSocket = serverSocket->getNewSocket();
     370  NetworkSocket* tempNetworkSocket = clientSocket->getNewSocket();
    363371
    364372  // we got new network node
  • branches/proxy/src/lib/network/network_stream.h

    r9459 r9463  
    4343    void connectToMasterServer(std::string host, int port);
    4444    void connectToProxyServer(int proxyId, std::string host, int port);
    45     void createServer(int port);
     45    void createServer(int clientPort, int proxyPort);
    4646
    4747    void createNetworkGameManager();
     
    110110    NetworkMonitor*            networkMonitor;              //!< the network monitor
    111111    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
    113114
    114115    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  
    7777
    7878/**
    79  * get newly connected client socket. note
     79 * get newly connected socket. note
    8080 * @return new socket or NULL if no new socket exists
    81  *
    82  *  only clients connect to this socket
    8381 */
    8482NetworkSocket * UdpServerSocket::getNewSocket( void )
     
    9593  return result;
    9694}
    97 
    98 
    99 /**
    100  * get newly connected proxy socket. note
    101  * @return new socket or NULL if no new socket exists
    102  *
    103  * only proxy servers connect to this socket
    104  */
    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 
    11995
    12096
Note: See TracChangeset for help on using the changeset viewer.