CServerConsole::CServerConsole(const wxString& title, const wxPoint& pos, const wxSize& size) :wxFrame((wxFrame *)NULL, -1, title, pos, size) { m_pText = new wxTextCtrl(this, -1, wxString::FromAscii(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY); m_pListClients = new wxListBox(this, -1); m_pListTasks = new wxListCtrl(this, -1, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_NO_HEADER | wxLC_HRULES); if (m_pListTasks) m_pListTasks->InsertColumn(0, wxString::FromAscii("Tasks")); #ifndef _NO_PROGRESS_INDICATOR CProgressIndicator::GetInstance()->SetDisplayProgressCallback(ProgressCallback, (long)this); #endif SetupCommandHandlers(); iClientIDCounter = 0; wxIPV4address addr; #ifndef HAVE_NO_SOCKET_LOCALHOST addr.LocalHost(); #endif addr.Service(3000); m_pServer = new wxSocketServer(addr); if (!m_pServer->Ok()) Log(wxString::FromAscii("Error starting server\n")); else { Log(wxString::FromAscii("Server started\n")); // Setup the event handler and subscribe to connection events m_pServer->SetEventHandler(*this, ID_SERVER_EVENT); m_pServer->SetNotify(wxSOCKET_CONNECTION_FLAG); m_pServer->Notify(TRUE); } /* // testing CCommandHandler CCommandHandler chTest; const CCommandHandler::CommandTableEntry *pTable = chTest.GetHandlersTable(); CParametersMap mapIn, mapOut; (chTest.*(pTable[0].procHandler))(mapIn, mapOut); //WOW!!! */ }
MSNConnection::MSNConnection() : BLooper("MSNConnection looper") { fState = otOffline; fTrID = 0; fManager = NULL; fRunner = NULL; fKeepAliveRunner = NULL; fServer = NULL; fSock = -1; fSockMsgr = NULL; fThread = -1; SetupCommandHandlers(); Run(); };
MSNConnection::MSNConnection(const char *server, uint16 port, MSNManager *man) : BLooper("MSNConnection looper") { fState = otOffline; fTrID = 0; fManager = NULL; fRunner = NULL; fKeepAliveRunner = NULL; fServer = NULL; fSock = -1; fSockMsgr = NULL; fThread = -1; SetupCommandHandlers(); Run(); SetTo(server,port,man); };