Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
An easy example of an extension of the BaseSocketManager class is a class to manage the client side of a game. Its job is to create a single socket that attaches to a known server.
class ClientSocketManager : public BaseSocketManager
{
std::string m_HostName;
unsigned int m_Port;
public:
ClientSocketManager(const std::string &hostName, unsigned int port)
{ m_HostName = hostName; m_Port = port; } bool Connect(); }; bool ClientSocketManager::Connect() { if (!BaseSocketManager::Init()) return false; RemoteEventSocket *pSocket = GCC_NEW RemoteEventSocket; if (!pSocket->Connect(GetHostByName(m_HostName), m_Port) ) { SAFE_DELETE(pSocket); return false; } AddSocket(pSocket); return true; }