コード例 #1
0
void NetworkDiscovery::getIP (QString address, AddressType type)
{
    switch (type)
    {
    case kMDNS:
        m_responder.query (address);
        break;
    case kIPv4:
        emit ipFound (address, address);
        break;
    case kIPv6:
        emit ipFound (address, address);
        break;
    default:
        QHostInfo::lookupHost (address, this,
                               SLOT (lookupFinished (QHostInfo)));
        break;
    }
}
コード例 #2
0
void CalculationsCore::run()
{
    while ( true )
    {
        if ( this->maxCalculations != 0
             && this->maxCalculations <= this->calculations )
        {
            break;
        }
        if ( this->cancel == true )
        {
            break;
        }
        this->sync.lock();
        if ( this->pause == true )
        {
            pauseCond.wait ( &this->sync );
        }
        this->sync.unlock();
        this->calculations++;
        std::vector<int> input = getRandomIp();
        std::vector< std::vector<int> > volume = getIpVolume ( input );
        std::vector< std::vector<double> > r_input = writeIp ( input, volume );
        double ip[3] = { r_input[0][0], r_input[1][0], r_input[2][0] };
        if ( searchIp ( ip ) == true )
        {
            this->coincidences++;
            Data::CalculationResult result;
            result.r_input = r_input;
            result.ipVolume = volume;
            result.calculations = this->calculations;
            result.coincidences = this->coincidences;
            emit ipFound ( this->coincidences );
            this->wr->saveResult ( result );
            if ( this->maxCoincidences != 0
                 && this->maxCoincidences <= this->coincidences )
            {
                break;
            }
        }
    }
    this->wr->writeEndingToFile();
}
コード例 #3
0
NetworkDiscovery::NetworkDiscovery()
{
    connect (&m_responder, SIGNAL (ipFound (QString, QString)),
             this,         SIGNAL (ipFound (QString, QString)));
}