*** QTSServer.cpp.old	Fri Aug 15 16:53:22 2003
--- QTSServer.cpp	Tue Oct 19 15:58:26 2004
***************
*** 465,471 ****
  
      delete [] thePortTrackers;
      return (fNumListeners > 0);
! }
  
  UInt32* QTSServer::GetRTSPIPAddrs(QTSServerPrefs* inPrefs, UInt32* outNumAddrsPtr)
  {
--- 465,471 ----
  
      delete [] thePortTrackers;
      return (fNumListeners > 0);
! }
  
  UInt32* QTSServer::GetRTSPIPAddrs(QTSServerPrefs* inPrefs, UInt32* outNumAddrsPtr)
  {
***************
*** 510,517 ****
          
          if ((numAddrs == 1) && (arrIndex == 0))
              theIPAddrArray[arrIndex++] = INADDR_ANY;
!         else
!             theIPAddrArray[arrIndex++] = INADDR_LOOPBACK;
      
          *outNumAddrsPtr = arrIndex;
      }
--- 510,517 ----
          
          if ((numAddrs == 1) && (arrIndex == 0))
              theIPAddrArray[arrIndex++] = INADDR_ANY;
!         //else
!         //    theIPAddrArray[arrIndex++] = INADDR_LOOPBACK;
      
          *outNumAddrsPtr = arrIndex;
      }
***************
*** 539,569 ****
      
      return thePortArray;
  }
! 
  Bool16  QTSServer::SetupUDPSockets()
  {
!     //function finds all IP addresses on this machine, and binds 1 RTP / RTCP
!     //socket pair to a port pair on each address.
!     
      UInt32 theNumAllocatedPairs = 0;
      for (UInt32 theNumPairs = 0; theNumPairs < SocketUtils::GetNumIPAddrs(); theNumPairs++)
      {
          UDPSocketPair* thePair = fSocketPool->CreateUDPSocketPair(SocketUtils::GetIPAddr(theNumPairs), 0);
                  if (thePair != NULL)
!                 {
!             theNumAllocatedPairs++;
                          thePair->GetSocketA()->RequestEvent(EV_RE);
                          thePair->GetSocketB()->RequestEvent(EV_RE);
                  }
!         }
      //only return an error if we couldn't allocate ANY pairs of sockets
      if (theNumAllocatedPairs == 0)
!         {
                  fServerState = qtssFatalErrorState; // also set the state to fatal error
                  return false;
!         }
      return true;
! }
  
  Bool16  QTSServer::SwitchPersonality()
  {
--- 539,599 ----
      
      return thePortArray;
  }
! 
! 
! // axjww 2004.10.18 This needs to be fixed to *NOT* bind to all ip addresses and only the ones
! // specified in bind_ip_addr in the config file. What were they thinking?
  Bool16  QTSServer::SetupUDPSockets()
  {
!     
! 	// ---- NEW
! 
! 	// uses the bind_ip_addr from the preferences file as the ip to bind to
! 	
!     UInt32 theNumAddrs = 0;
!     UInt32* theIPAddrs = this->GetRTSPIPAddrs(fSrvrPrefs, &theNumAddrs);   
!     UInt32 index = 0;
!     UInt32 theNumAllocatedPairs = 0;
!     
!     for (index = 0; index < theNumAddrs; index++)
!     {
!         UDPSocketPair* thePair = fSocketPool->CreateUDPSocketPair(theIPAddrs[index], 0);
!                 if (thePair != NULL)
! 		        {
! 					    theNumAllocatedPairs++;
!                         thePair->GetSocketA()->RequestEvent(EV_RE);
!                         thePair->GetSocketB()->RequestEvent(EV_RE);
!                 }
!     }
!               
! 
! 
! 	// ---- OLD
! 	/*
!     //function finds all IP addresses on this machine, and binds 1 RTP / RTCP
!     //socket pair to a port pair on each address.
! 
      UInt32 theNumAllocatedPairs = 0;
      for (UInt32 theNumPairs = 0; theNumPairs < SocketUtils::GetNumIPAddrs(); theNumPairs++)
      {
          UDPSocketPair* thePair = fSocketPool->CreateUDPSocketPair(SocketUtils::GetIPAddr(theNumPairs), 0);
                  if (thePair != NULL)
! 		        {
! 					    theNumAllocatedPairs++;
                          thePair->GetSocketA()->RequestEvent(EV_RE);
                          thePair->GetSocketB()->RequestEvent(EV_RE);
                  }
!     }
! 	*/
! 
      //only return an error if we couldn't allocate ANY pairs of sockets
      if (theNumAllocatedPairs == 0)
!     {
                  fServerState = qtssFatalErrorState; // also set the state to fatal error
                  return false;
!     }
      return true;
! }
  
  Bool16  QTSServer::SwitchPersonality()
  {
