Main Site Documentation

G400D - Setting Static IP with leading zeros


#1

I believe I found an issue with the G400D and setting a static IP Address with leading zeros.
If you set the IP address as “10.0.26.18” it works fine, but if you set it as “010.000.026.018” it then reports it’s IP address as “8.0.22.16” see sample program below

This was not the case with ChipworkX and MF v4.1.

 public class Program
   {

      static EthernetBuiltIn eNet = new EthernetBuiltIn();

      public static void Main()
      {
         eNet.Open();
         NetworkInterfaceExtension.AssignNetworkingStackTo(eNet);

         eNet.NetworkInterface.EnableStaticIP("010.000.026.018", "255.255.255.0", "0.0.0.0");
         eNet.NetworkInterface.EnableStaticDns(new string[] { "0.0.0.0", "0.0.0.0" });

         Debug.Print("IP Address: " + eNet.NetworkInterface.IPAddress);
         Debug.Print("Subnet Mask: " + eNet.NetworkInterface.SubnetMask);
         Debug.Print("Gateway: " + eNet.NetworkInterface.GatewayAddress);

         System.Threading.Thread.Sleep(-1);
      }

   }