Exemplo n.º 1
0
        private void send()
        {
            FindDNSServers getDNS         = new FindDNSServers();
            ArrayList      dnsServerArray = getDNS.GetDNS();

            for (int c = 0; c < dnsServerArray.Count; c++)
            {
                try
                {
                    //wait up to ~6 seconds for results from the DNS server before killing the process. If more DNS addresses exist loop through the list and keep trying.
                    dnsServer = dnsServerArray[c].ToString();
                    ThreadStart entryPoint = new ThreadStart(completeSend);
                    Thread      sendThread = new Thread(entryPoint);
                    int         ctr        = 60;
                    sendThread.Start();
                    while (ctr > 0)
                    {
                        sendThread.Join(100);   //suspend loop execution for interval.
                        if (results > -100)     //worker thread has completed.
                        {
                            break;
                        }
                        ctr -= 1;
                    }
                    if (results == -100)        //worker thread has not completed.
                    {
                        sendThread.Abort();
                    }
                    else                        //DNS server has returned data.
                    {
                        break;
                    }
                }
                catch (ThreadStateException e)
                {
                    throw new TLDVerifyException(e);
                }
            }
        }
Exemplo n.º 2
0
 private void send()
 {
     FindDNSServers getDNS = new FindDNSServers();
     ArrayList dnsServerArray = getDNS.GetDNS();
     for (int c = 0; c < dnsServerArray.Count; c++)
     {
         try
         {
             //wait up to ~6 seconds for results from the DNS server before killing the process. If more DNS addresses exist loop through the list and keep trying.
             dnsServer = dnsServerArray[c].ToString();
             ThreadStart entryPoint = new ThreadStart(completeSend);
             Thread sendThread = new Thread(entryPoint);
             int ctr = 60;
             sendThread.Start();
             while (ctr > 0)
             {
                 sendThread.Join(100);   //suspend loop execution for interval.
                 if (results > -100)     //worker thread has completed.
                 {
                     break;
                 }
                 ctr -= 1;
             }
             if (results == -100)        //worker thread has not completed.
             {
                 sendThread.Abort();
             }
             else                        //DNS server has returned data.
             {
                 break;
             }
         }
         catch (ThreadStateException e)
         {
             throw new TLDVerifyException(e);
         }
     }
 }