int main(int argc, char** argv) { char* host = 0; if (argc > 1) host = argv[1]; if (!host) { printf("Usage: %s address\n", argv[0]); printf("A simple dns lookup utility parser\n"); exit(-1); } SocketMonitor* monitor = SocketMonitor::getInstance(); DNSResolver resolver; resolver.lookup(host); while (running) { monitor->wait(25); } }
void SocketConnection::readMessages( SocketMonitor& s ) { if( !m_pSession ) return; std::string msg; while( readMessage( msg ) ) { try { m_pSession->next( msg, UtcTimeStamp() ); } catch ( InvalidMessage& ) { if( !m_pSession->isLoggedOn() ) s.drop( m_socket ); } } }
void onError( SocketMonitor& monitor, int socket ) { m_strategy.onDisconnect( m_server, socket ); monitor.drop( socket ); }