Class KomodiaDNS::CDNSAnswers::
GetAddress()
Base ClassesData ItemsConstructorsDestructorsFunctionsCustom CodeGo to hierarchy chart    Prev page: ~CDNSAnswersNext page: GetAIPAnswer    Show member index
Public Function Declared in:
DNSAnswers.h

'Declaration' icon -- Shortcut to top of page. Declaration

unsigned long GetAddress(
    unsigned short usIndex=0) const;

'Description' icon -- Shortcut to top of page. Description

With all this data, just get the address

'Function Body' icon -- Shortcut to top of page. Function Body

try
{
    if (!m_aDNSHeader.usARCount ||
        !m_aDNSHeader.usANCount)
    {
        //Report it
        ReportError("GetAddress","No answers!");

        //Exit
        return 0;
    }

    //Get to the actual answer
    unsigned short usPrior;
    usPrior=m_aDNSHeader.usANCount+
            m_aDNSHeader.usNSCount;

    for (unsigned short usCounter=usIndex;
         usCounter<m_aDNSHeader.usARCount-usIndex;
         ++usCounter)
        if (m_aAnswers[usPrior+usCounter].GetResourceType()==CDNSQuery::A)
        {
            //Get the data
            std::string sData;
            sData=m_aAnswers[usPrior+usCounter].GetData();

            //Convert it to long
            return atol(sData.c_str());
        }

    //Nothing
    return 0;
}
ERROR_HANDLER_RETURN("GetAddress",0)

'See Also' icon -- Shortcut to top of page. See Also

Class Overview Class Overview  |  Public base class CErrorHandler  |  Hierarchy Chart Hierarchy Chart


Get Surveyor!This web site was generated using Surveyor V4.50.811.1.  Click here for more information. Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003.