33 for( AddressList::const_iterator p = address_list.begin() ; p != address_list.end() ; ++p )
44 result.push_back( address ) ;
57 for( AddressList::iterator p = result.begin() ; p != result.end() ; ++p )
58 (*p).setPort( port ) ;
72 for( G::Strings::const_iterator p = list.begin() ; p != list.end() ; ++p )
85 if( use_connection_lookup )
89 for( AddressList::const_iterator p = address_list.begin() ; p != address_list.end() ; ++p )
91 init( *p , m_connection_lookup.get() ) ;
101 G_ASSERT( ! address_list.empty() ) ;
102 for( AddressList::const_iterator p = address_list.begin() ; p != address_list.end() ; ++p )
113 m_server_list.back().swap( ptr ) ;
123 for( List::iterator p = m_server_list.begin() ; p != m_server_list.end() ; ++p )
127 (*p).get()->cleanup() ;
137 for( List::const_iterator p = m_server_list.begin() ; p != m_server_list.end() ; ++p )
139 const Server & server = *((*p).get()) ;
140 G_LOG_S(
"GNet::MultiServer: " << type <<
" server on " << server.
address().second.displayString() ) ;
147 for( List::const_iterator p = m_server_list.begin() ; p != m_server_list.end() ; ++p )
149 if( (*p).get()->address().first )
151 result.first = true ;
152 result.second = (*p).get()->address().second ;
163 Server(address,connection_lookup) ,
170 return m_ms.newPeer( peer_info ) ;
202 std::swap( other.m_p , m_p ) ;
MultiServerPtr(ServerImp *=NULL)
Constructor.
static AddressList addressList(const Address &)
A trivial convenience fuction that returns the given addresses as a single-element list...
An abstract base class for the GNet::Server's connection to a remote client.
static bool canBind(const Address &listening_address, bool do_throw)
Checks that the specified address can be bound.
A private implementation class used by GNet::MultiServer.
MultiServer()
Default constructor. Initialise with init().
void swap(MultiServerPtr &)
Swaps internals with the other.
std::list< std::string > Strings
A std::list of std::strings.
MultiServerImp * get()
Returns the raw pointer.
The Address class encapsulates an IP transport address.
static Address invalidAddress()
Returns an invalid address.
A class for getting more information about a connection from the operating system.
A network server class which listens on a specific port and spins off ServerPeer objects for each inc...
virtual ServerPeer * newPeer(PeerInfo)
Server peer factory method.
static bool canBind(const AddressList &listening_address_list, bool do_throw)
Checks that the specified addresses can be bound.
void cleanup()
Does cleanup.
virtual ~MultiServer()
Destructor.
A private implementation class used by GNet::MultiServer.
void init(const AddressList &address_list)
Initilisation after default construction.
MultiServerImp(MultiServer &ms, const Address &, ConnectionLookup *)
Constructor.
std::list< Address > AddressList
void serverCleanup()
Should be called from all derived classes' destructors so that peer objects can use their Server obje...
~MultiServerPtr()
Destructor.
A server that listens on more than one interface using a facade pattern to multiple Server instances...
std::pair< bool, Address > firstAddress() const
Returns the first listening address.
A structure used in GNet::Server::newPeer().
std::pair< bool, Address > address() const
Returns the listening address.
void serverReport(const std::string &server_type) const
Writes to the system log a summary of the underlying server objects and their addresses.
void operator=(const MultiServerPtr &)
Assignment operator.