Example #1
0
        public static void Test()
        {
            IPSubnet ipRange = new IPSubnet("10.10.10.0", 24);
            Console.WriteLine(ipRange.NetworkAddress);
            Console.WriteLine(ipRange.BroadcastAddress);
            ipRange.setRandom(false);
            int count = (int)ipRange.size();

            ArrayList list = new ArrayList();

            foreach(String ip in ipRange)
            {
                //System.Console.Out.WriteLine(ip);
                list.Add(ip);
                if (--count == 0)
                    break;
            }

            IPAddressList ipList = new IPAddressList(list);
            ipList.setRandom(false);
            count = (int)ipList.size();
            foreach(String ip in ipList)
            {
                System.Console.Out.WriteLine(ip);
                if (--count == 0)
                    break;
            }
        }
Example #2
0
 public virtual void  testSubnet2()
 {
     try
     {
         IPSubnet subnet = new IPSubnet("10.10.10.0 255.255.255.0");
         int      count  = 200;
         //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'"
         foreach (String ip in subnet)
         {
             //UPGRADE_TODO: Method 'java.io.PrintStream.println' was converted to 'System.Console.Out.WriteLine' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioPrintStreamprintln_javalangObject'"
             System.Console.Out.WriteLine(ip);
             if (--count == 0)
             {
                 break;
             }
         }
     }
     catch (System.Exception e)
     {
         // TODO Auto-generated catch block
         SupportClass.WriteStackTrace(e, Console.Error);
         //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
         Assert.Fail(e.ToString());
     }
 }
Example #3
0
 public virtual void testSubnet2()
 {
     try
     {
         IPSubnet subnet = new IPSubnet("10.10.10.0 255.255.255.0");
         int count = 200;
         //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'"
         foreach(String ip in subnet)
         {
             //UPGRADE_TODO: Method 'java.io.PrintStream.println' was converted to 'System.Console.Out.WriteLine' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioPrintStreamprintln_javalangObject'"
             System.Console.Out.WriteLine(ip);
             if (--count == 0)
                 break;
         }
     }
     catch (System.Exception e)
     {
         // TODO Auto-generated catch block
         SupportClass.WriteStackTrace(e, Console.Error);
         //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
         Assert.Fail(e.ToString());
     }
 }