Java Reference
In-Depth Information
Figure 4.1: Scan for Sites
First the IP prefix is checked to see if it ends with a period “.”. If it does not end this way,
then a period is appended. This is because we need the IP prefix in the form:
192.168.1.
not
192.168.1
We will be appending a count from 0 to 255 to the end, so the trailing period is completely
necessary.
if (!ip.endsWith("."))
{
ip += ".";
}
Next, an array is created to hold a list of the sites that are located. The sites located are
not displayed until the end of the scan.
// Create a list to hold sites found.
List<String> list = new ArrayList<String>();
Search WWH ::




Custom Search