Purpose: Activates all listening sockets added to the server by AddPort(). This must only be called once. Arguments: None
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hzIpServer::Activate | (void) |
Declared in file: hzIpServer.h
Defined in file : hzIpServer.cpp
Function Logic:
Function body:
hzEcode hzIpServer::Activate (void)
{
// Purpose: Activates all listening sockets added to the server by AddPort(). This must only be called once.
//
// Arguments: None
//
// Returns: E_INITDUP If this has already been called
// E_INITFAIL If one or more listening sockets fail to activate
// E_OK If the operation was successful.
_hzfunc("hzIpServer::Activate") ;
if (m_bActive)
{
hzerr(E_INITDUP, "All ports already active") ;
return E_INITDUP ;
}
hzList<hzIpListen*>::Iter I ; // Listening socket iterator
hzIpListen* pLS ; // Listening socket
for (I = m_LS ; I.Valid() ; I++)
{
pLS = I.Element() ;
// Activate port
if (pLS->Activate() != E_OK)
{
hzerr(E_INITFAIL, "Could not activate listening port (sock %d)", pLS->GetPort()) ;
return E_INITFAIL ;
}
}
m_bActive = true ;
return E_OK ;
}