now = System.currentTimeMillis(); nextTime= now + waitTime; try
int waitTime = DNSConstants.ANNOUNCE_WAIT_INTERVAL; long now, nextTime; for(int i = 0;i<2;i++)
  void announce(DNSRecord.Address host)  {    //As per section 9.3  Send a gratuitous response at least 2 times 1 sec apart.    int waitTime = DNSConstants.ANNOUNCE_WAIT_INTERVAL;    long now, nextTime;    for(int i = 0;i<2;i++)    {      now = System.currentTimeMillis();              nextTime= now + waitTime;      try      {        DNSOutgoing out = new DNSOutgoing(DNSConstants.FLAGS_QR_RESPONSE | DNSConstants.FLAGS_AA);            //Initial startup.  All we have is the host record.  Later add support        //for starting with a list of services.  But for now......        out.addAnswer(host, 0);             send(out);        }      catch(java.io.IOException e)      {        //Should do something smarter here shuch as bomb out completly        System.err.println("Announce got an error: " +e);      }      now = System.currentTimeMillis();            if (now < nextTime)       {        //wait what is left of the probe wait time.                waitInterval(nextTime - now);          continue;      }    }  }