Sufi,
FYI - An IP address is composed of 4 octets. The values range from 0 to
255. 255 is used as a broadcast address too and is normally not used as a
value in an IP address
You should just increment an integer, convert it to a string, and compose
your IP address by concatenating the strings.

-Richard
int octet1, octet2, octet3, octet4;
octet4=155;
octet3=108;
octet2=0;
octet1=0;
boolean finished=false;
while (!finished)
{
         String IPAddress = (new String(octet4)) + "." + (new
String(octet3) + "." + (new String(octet2) + "." + (new String(octet4));
         /*
            * do your work here
          */
         octet1++;
         if (octet1== 255)
         {
                 octet2++;
                 octet1=0;
         }
         if (octet2==255)
                 finished=true;
}

At 09:27 PM 2/4/2002 +0000, you wrote:
>I wrote a java program that scan port, I gave ip addresses from the command
>line, for example I want to know if port 80 is running in ip1 ip2 ip3 :
>java scan ip1 ip2 ip3
>and I get the resault ( it's working fine), now because the ip address of
>all the machines has this form : 155.108.xxx.xxx, my question is how to
>increment this ip address from 155.108.000.000. to 155.108.999.999
>thanks
>
>
>_________________________________________________________________
>Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
>http://archives.java.sun.com/jsp-interest.html
>http://java.sun.com/products/jsp/faq.html
>http://www.esperanto.org.nz/jsp/jspfaq.jsp
>http://www.jguru.com/faq/index.jsp
>http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to