R2 Beta2 network strange behaviour

The code showed below is working fine, but I face this problem on G400 and Hydra 4.3b2 fw:

  • G400 and Hydra HttpListner/sockets starts fine only if in VS debug mode.
  • EMX Spider works fine in any condition. (It uses BuiltIn Ethernet)

My first impression is that something is running too fast on G400/Hydra board and so for some reason it’s messing up network … but I couldn’t find the problem.
In 4.2 the problem doesn’t show up in any board.


...

        void ProgramStarted()
        {
            // Serial port startup
            PubRs232 = rs232;
            rs232.Configure(19200, GT.SocketInterfaces.SerialParity.None, GT.SocketInterfaces.SerialStopBits.One, 8, GT.SocketInterfaces.HardwareFlowControl.NotRequired);
            rs232.Port.Open();

            button.TurnLedOn();
            //readadc = new AutoResetEvent(false);
            //adc = new Ledonet.Adc3424Board.AdcMcp3424(ADCSOCKET);
            pTcp = new TcpManager("192.168.20.77", "192.168.20.1", "255.255.255.0", "");
            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            //StartSDLogger(sdCard);
            //SetupAdc();
            //button.ButtonPressed += button_ButtonPressed;
            button.TurnLedOff();
            Debug.Print("Program Started");
        }


       public TcpManager(string ipaddr, string gwaddr, string netmask, string ntpserver)
        {
            _boardIp = ipaddr;
            _boardGw = gwaddr;
            _boardNetmask = netmask;
            _NtpServer = ntpserver;

            StartEthernet();

            SMSHttpListenerThread = new Thread(new ThreadStart(TcpThreadManager));
            SMSHttpListenerThread.Start();
            TimeServerRun2(_NtpServer);
        }

        static void StartEthernet()
        {
            Eth1 = CreateEthernetInterface();
            NetworkChange.NetworkAddressChanged += new NetworkAddressChangedEventHandler(Eth1_NetworkAddressChanged);
            NetworkChange.NetworkAvailabilityChanged += new NetworkAvailabilityChangedEventHandler(Eth1_CableConnectivityChanged);
            Eth1.PhysicalAddress = new byte[] { 0x00, 0xC0, 0x03, 0x00, 0xC1, 0x16 }; // MACADDR: 00-C0-03-00-C1-03
            Eth1.EnableStaticIP(_boardIp, _boardNetmask, _boardGw); // class C net
            string [] DnsAddresses = new string[] { "8.8.8.8" , "192.168.20.1"};
            Eth1.EnableStaticDns(DnsAddresses);
            Eth1.Open();
            NetworkAddrChangeBlocking = new ManualResetEvent(false);
            if (!Eth1.CableConnected)
            {
                NetworkAvailablityBlocking = new ManualResetEvent(false);
                do
                {
                    if (!Eth1.CableConnected)
                    {
                        DebugPrint.Print("Ethernet cable is not connected yet.");
                    }
                    else
                        break;
                }
                while (!NetworkAvailablityBlocking.WaitOne(5000, false));
            }
            
            DebugPrint.Print("Try to set IP addr ....");
            while (IPAddress.GetDefaultLocalAddress() == IPAddress.Any || !NetworkAddrChangeBlocking.WaitOne(500, false))
            {
                Thread.Sleep(50);
            }
            DebugPrint.Print("IP address is set " + Eth1.IPAddress.ToString()); //+ " - " + EthernetENC28J60.ActiveInterface.IPAddress);
        }

        
        static void Eth1_CableConnectivityChanged(object sender, NetworkAvailabilityEventArgs e)
        {
            DebugPrint.Print("Built-in Ethernet Cable is " + (e.IsAvailable ? "Connected!" : "Disconnected!"));

            if (e.IsAvailable)
            {
                if ( NetworkAvailablityBlocking != null)
                    NetworkAvailablityBlocking.Set();
            }    
        }
        

        static void Eth1_NetworkAddressChanged(object sender, EventArgs e)
        {
            DebugPrint.Print("New address for The built-in Ethernet Network Interface ");
            
            DebugPrint.Print("Is DhCp enabled: " + Eth1.IsDhcpEnabled);
            DebugPrint.Print("Is DynamicDnsEnabled enabled: " + Eth1.IsDynamicDnsEnabled);
            DebugPrint.Print("NetworkInterfaceType " + Eth1.NetworkInterfaceType);
            DebugPrint.Print("Network settings:");
            DebugPrint.Print("IP Address: " + Eth1.IPAddress);
            DebugPrint.Print("Subnet Mask: " + Eth1.SubnetMask);
            DebugPrint.Print("Default Getway: " + Eth1.GatewayAddress);
            DebugPrint.Print("Number of DNS servers:" + Eth1.DnsAddresses.Length);
            /*
            for (int i = 0; i < Eth1.DnsAddresses.Length; i++)
                DebugPrint.Print("DNS Server " + i.ToString() + ":" + Eth1.DnsAddresses[i]);
            */
            DebugPrint.Print("----------------------------------------------");
            NetworkAddrChangeBlocking.Set();
        }

        static HttpListener listener;
        //***************************************************************************
        void TcpThreadManager()
        {
            // setup thread
            listener = null;
            HttpListenerContext wctx = null;
            Thread.Sleep(500);
            DebugPrint.Print("HttpListener thread started ....");
            while (true)
            {
                // wait for call from client:
                try
                {
                    if (listener == null)
                    {
                        listener = new HttpListener("http", 8080);
                        //listener.MaximumResponseHeadersLength = 4096;                        
                        listener.Start();
                        DebugPrint.Print("HttpListener created....");

                   }
                    wctx = listener.GetContext();                   
                    // got call:       
                    //DebugPrint.Print("Got Call !");
                     if (wctx.Request == null)
                        continue;
                    //SdCardUtility.LogPrint("URL: " + wctx.Request.RawUrl);
                }
                catch (SocketException)
                {
                    DebugPrint.Print("HttpListener stopped, cleared then restart it ... !");
                    if (listener != null)
                    {
                        //listener.Stop();
                        listener.Close();
                        listener = null;
                        Thread.Sleep(5000);
                    }
                    continue;
                }
                // Process request
                ProcessHttpRequest(wctx); // threaded version
                //HttpContextServiceThread(wctx); // single version (don't use!)
            }
        }

        void ProcessHttpRequest(HttpListenerContext wctx)
        {
            Thread _servicethread = new Thread(
                delegate()
                {
                    HttpContextServiceThread(wctx);
                }
                );
            _servicethread.Start();
        }


To note that TimeServer is running fine on all the boards although the HttpListener is not responding. The boards are all pingable.

@ dobova - I can’t tell you why it is not working, but I think this code should not compile with a 4.3 FW because “CableConnected” was renamed to “NetworkAvailable” (at least for ENC28)
The code for CreateEthernetInterface(); is missing, so I don’t know what interface you are using here.

I also call the Eth1.EnableStaticIP(…) after the call to Open(), may be there is an issue.

btw. I have used it with G120 + ENC28.

Edit: And there is a bug at least in the ENC28Interface class:
NetworkAvailable stays true as soon as network was available once, and never goes back to false. But according to GHI this is fixed in next SDK.
As a workaround I remember the state from the NetworkAvaiabilitiChanged event in an bool flag.

Hi Reinhard, thanks to point out my code.
The CableConnected is valid and it compiles nice in 4.3.
The code shown works fine on G400HDR, RAPTOR and Hydra, but ONLY if I start program with VS debug. Otherwise it locks somewhere in the socket creation.

The Spider is using BuiltIn ethernet. So may be the problem is inside Enc28 code.

The code inside CreateEthernetInterface is just a class factory for EthernetEnc28J60 or EthernetBuiltIn I use in test code to switch Ethernet setup for different board:

 
        //static EthernetENC28J60 CreateEthernetInterface()
        static EthernetBuiltIn CreateEthernetInterface()
        {

            // ********** G400 Raptor socket 1
            //Eth1 = new EthernetENC28J60(SPI.SPI_module.SPI2, GHI.Hardware.G400.Pin.PB5, GHI.Hardware.G400.Pin.PB0, GHI.Hardware.G400.Pin.PA7, 4000);
            // ********** G400 HDR
            //Eth1 = new EthernetENC28J60(SPI.SPI_module.SPI2, GHI.Pins.G400.PC22, GHI.Pins.G400.PC31, GHI.Pins.G400.PA5, 4000);
            //Eth1 = new EthernetENC28J60(SPI.SPI_module.SPI2, (Cpu.Pin)86, (Cpu.Pin)95, (Cpu.Pin)5, 4000);
            // ********** G120 Cobra II
            //Eth1 = new EthernetENC28J60(SPI.SPI_module.SPI2, GHI.Hardware.G120.Pin.P1_17, GHI.Hardware.G120.Pin.P2_21 , GHI.Hardware.G120.Pin.P1_14);
            // ********** EMX Spider (Built in)
            Eth1 = new EthernetBuiltIn();
            // EMX Enc28 SPI board 
            //Eth1 = new EthernetENC28J60();
            // ********** FEZHydra ****
            //Eth1 = new EthernetENC28J60(SPI.SPI_module.SPI1, GHI.Pins.Generic.GetPin('A', 29),
            //                                    GHI.Pins.Generic.GetPin('D', 17), GHI.Pins.Generic.GetPin('A', 13), 4000);
            //Eth1 = new EthernetENC28J60(SPI.SPI_module.SPI1, GHI.Pins.G400.PB13, 
            //                                 GHI.Pins.G400.PB8   , GHI.Pins.G400.PB9, 4000);
            //Eth1 = new EthernetENC28J60(SPI.SPI_module.SPI1, (Cpu.Pin) 45, (Cpu.Pin) 40, (Cpu.Pin) 41, 4000); //socket 3
            //Eth1 = new EthernetENC28J60(SPI.SPI_module.SPI1, (Cpu.Pin) 46, (Cpu.Pin) 34, (Cpu.Pin) 11, 4000); // socket 4

            //foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
            //{
            //    DebugPrint.Print(" -> " + nic.NetworkInterfaceType.ToString());
            //}
            return Eth1;
        }


I have good and bad news:
I recreated your sample as a plain NETMF console app with my Raptor and ENC28 and I can confirm that it works with attached debugger, but not if I just press reset.
The bad news are I have no solution to this so far.
Since I have a nice display connected I will create some output there to make it easier to investigate.

Edit: without debugger it runs up to the line


But it does never return.

Also:
When I press reset on my Raptor (witch CP7) the display slowly fades into white.
Then it takes several seconds (>15 I'd say), then it reboots again (Windows recognices new device). This happens all the time

Here is my code:

```cs
using System;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using GHI.Networking;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using Microsoft.SPOT.Net.NetworkInformation;

namespace RaptorNetTest1
{
   public class Program
   {
      private static TcpManager pTcp;

      public static void Main()
      {
         pTcp = new TcpManager("192.168.178.200", "192.168.178.1", "255.255.255.0", "");

         Thread.Sleep(-1);
      }

   }
   public class TcpManager
   {
      public TcpManager(string ipaddr, string gwaddr, string netmask, string ntpserver)
         {
             _boardIp = ipaddr;
             _boardGw = gwaddr;
             _boardNetmask = netmask;
             _NtpServer = ntpserver;

             StartEthernet();

             SMSHttpListenerThread = new Thread(new ThreadStart(TcpThreadManager));
             SMSHttpListenerThread.Start();
             //TimeServerRun2(_NtpServer);
         }

      public Thread SMSHttpListenerThread { get; set; }

      static EthernetENC28J60 CreateEthernetInterface()
      //static EthernetBuiltIn CreateEthernetInterface()
      {

         // ********** G400 Raptor socket 1
         Eth1 = new EthernetENC28J60(SPI.SPI_module.SPI2, GHI.Pins.G400.PB5, GHI.Pins.G400.PB0, GHI.Pins.G400.PA7, 4000);
         // ********** G400 HDR
         //Eth1 = new EthernetENC28J60(SPI.SPI_module.SPI2, GHI.Pins.G400.PC22, GHI.Pins.G400.PC31, GHI.Pins.G400.PA5, 4000);
         //Eth1 = new EthernetENC28J60(SPI.SPI_module.SPI2, (Cpu.Pin)86, (Cpu.Pin)95, (Cpu.Pin)5, 4000);
         // ********** G120 Cobra II
         //Eth1 = new EthernetENC28J60(SPI.SPI_module.SPI2, GHI.Hardware.G120.Pin.P1_17, GHI.Hardware.G120.Pin.P2_21 , GHI.Hardware.G120.Pin.P1_14);
         // ********** EMX Spider (Built in)
         //Eth1 = new EthernetBuiltIn();
         // EMX Enc28 SPI board 
         //Eth1 = new EthernetENC28J60();
         // ********** FEZHydra ****
         //Eth1 = new EthernetENC28J60(SPI.SPI_module.SPI1, GHI.Pins.Generic.GetPin('A', 29),
         //                                    GHI.Pins.Generic.GetPin('D', 17), GHI.Pins.Generic.GetPin('A', 13), 4000);
         //Eth1 = new EthernetENC28J60(SPI.SPI_module.SPI1, GHI.Pins.G400.PB13, 
         //                                 GHI.Pins.G400.PB8   , GHI.Pins.G400.PB9, 4000);
         //Eth1 = new EthernetENC28J60(SPI.SPI_module.SPI1, (Cpu.Pin) 45, (Cpu.Pin) 40, (Cpu.Pin) 41, 4000); //socket 3
         //Eth1 = new EthernetENC28J60(SPI.SPI_module.SPI1, (Cpu.Pin) 46, (Cpu.Pin) 34, (Cpu.Pin) 11, 4000); // socket 4

         //foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
         //{
         //    DebugPrint.Print(" -> " + nic.NetworkInterfaceType.ToString());
         //}
         return Eth1;
      }

      public static EthernetENC28J60 Eth1 { get; set; }

      static void StartEthernet()
         {
             Eth1 = CreateEthernetInterface();
             NetworkChange.NetworkAddressChanged += new NetworkAddressChangedEventHandler(Eth1_NetworkAddressChanged);
             NetworkChange.NetworkAvailabilityChanged += new NetworkAvailabilityChangedEventHandler(Eth1_CableConnectivityChanged);
             Eth1.PhysicalAddress = new byte[] { 0x00, 0xC0, 0x03, 0x00, 0xC1, 0x16 }; // MACADDR: 00-C0-03-00-C1-03
             Eth1.EnableStaticIP(_boardIp, _boardNetmask, _boardGw); // class C net
             string [] DnsAddresses = new string[] { "8.8.8.8" , "192.168.20.1"};
             Eth1.EnableStaticDns(DnsAddresses);
             Eth1.Open();
             NetworkAddrChangeBlocking = new ManualResetEvent(false);
             if (!Eth1.CableConnected)
             {
                 NetworkAvailablityBlocking = new ManualResetEvent(false);
                 do
                 {
                     if (!Eth1.CableConnected)
                     {
                         Debug.Print("Ethernet cable is not connected yet.");
                     }
                     else
                         break;
                 }
                 while (!NetworkAvailablityBlocking.WaitOne(5000, false));
             }
             
             Debug.Print("Try to set IP addr ....");
             while (IPAddress.GetDefaultLocalAddress() == IPAddress.Any || !NetworkAddrChangeBlocking.WaitOne(500, false))
             {
                 Thread.Sleep(50);
             }
             Debug.Print("IP address is set " + Eth1.IPAddress.ToString()); //+ " - " + EthernetENC28J60.ActiveInterface.IPAddress);
         }

      public static ManualResetEvent NetworkAvailablityBlocking { get; set; }

      public static ManualResetEvent NetworkAddrChangeBlocking { get; set; }


      static void Eth1_CableConnectivityChanged(object sender, NetworkAvailabilityEventArgs e)
         {
             Debug.Print("Built-in Ethernet Cable is " + (e.IsAvailable ? "Connected!" : "Disconnected!"));

             if (e.IsAvailable)
             {
                 if ( NetworkAvailablityBlocking != null)
                     NetworkAvailablityBlocking.Set();
             }    
         }
         

         static void Eth1_NetworkAddressChanged(object sender, EventArgs e)
         {
             Debug.Print("New address for The built-in Ethernet Network Interface ");
             
             Debug.Print("Is DhCp enabled: " + Eth1.IsDhcpEnabled);
             Debug.Print("Is DynamicDnsEnabled enabled: " + Eth1.IsDynamicDnsEnabled);
             Debug.Print("NetworkInterfaceType " + Eth1.NetworkInterfaceType);
             Debug.Print("Network settings:");
             Debug.Print("IP Address: " + Eth1.IPAddress);
             Debug.Print("Subnet Mask: " + Eth1.SubnetMask);
             Debug.Print("Default Getway: " + Eth1.GatewayAddress);
             Debug.Print("Number of DNS servers:" + Eth1.DnsAddresses.Length);
             /*
             for (int i = 0; i < Eth1.DnsAddresses.Length; i++)
                 DebugPrint.Print("DNS Server " + i.ToString() + ":" + Eth1.DnsAddresses[i]);
             */
             Debug.Print("----------------------------------------------");
             NetworkAddrChangeBlocking.Set();
         }

         static HttpListener listener;
      private static string _boardIp;
      private static string _boardGw;
      private static string _boardNetmask;
      private string _NtpServer;
      //***************************************************************************
         void TcpThreadManager()
         {
             // setup thread
             listener = null;
             HttpListenerContext wctx = null;
             Thread.Sleep(500);
             Debug.Print("HttpListener thread started ....");
             while (true)
             {
                 // wait for call from client:
                 try
                 {
                     if (listener == null)
                     {
                         listener = new HttpListener("http", 80);
                         //listener.MaximumResponseHeadersLength = 4096;                        
                         listener.Start();
                         Debug.Print("HttpListener created....");

                    }
                     wctx = listener.GetContext();                   
                     // got call:       
                     //DebugPrint.Print("Got Call !");
                      if (wctx.Request == null)
                         continue;
                     //SdCardUtility.LogPrint("URL: " + wctx.Request.RawUrl);
                 }
                 catch (SocketException)
                 {
                     Debug.Print("HttpListener stopped, cleared then restart it ... !");
                     if (listener != null)
                     {
                         //listener.Stop();
                         listener.Close();
                         listener = null;
                         Thread.Sleep(5000);
                     }
                     continue;
                 }
                 // Process request
                 ProcessHttpRequest(wctx); // threaded version
                 //HttpContextServiceThread(wctx); // single version (don't use!)
             }
         }

         void ProcessHttpRequest(HttpListenerContext wctx)
         {
             Thread _servicethread = new Thread(
                 delegate()
                 {
                    string responseString = "<HTML><BODY> Hello world! " + DateTime.Now + "</BODY></HTML>";
                    byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString);
                    // Get a response stream and write the response to it.
                    wctx.Response.ContentLength64 = buffer.Length;
                    System.IO.Stream output = wctx.Response.OutputStream;
                    output.Write(buffer, 0, buffer.Length);
                    // You must close the output stream.
                    output.Close();

                    //HttpContextServiceThread(wctx);
                 }
                 );
             _servicethread.Start();
         }
   }
}

I have added the following references:
GHI.Hardware
GHI.Networking
GHI.Pins
Microsoft.SPOT.Hardware
Microsoft.SPOT…IO
Microsoft.SPOT.Native
Microsoft.SPOT.Net
mscorlib
System
System.Http

@ Reinhard Ostermeier - Many thanks for your interest !!!

I’ve also got rid of all Debug.Print and I’ve used debug through the rs232, but no change. It locks up at GetContext() call.
I have no idea. I will wait new beta.

@ dobova - One more idea.
Try to add a delay between listener.Start(); and listener.GetContext();
You should also report it on the beta 1 thread as GHI asked for to report bugs.

@ Reinhard Ostermeier - Good idea… i will test tomorrow.

The problem is still present also using Thred.Sleep() between Start() and GetContex() call.
This could be a problem of SPI bus but I can’t figure out.

@ Reinhard Ostermeier -

[quote]
I have good and bad news:
I recreated your sample as a plain NETMF console app with my Raptor and ENC28 and I can confirm that it works with attached debugger, but not if I just press reset.
The bad news are I have no solution to this so far.
Since I have a nice display connected I will create some output there to make it easier to investigate.[/quote]

Good news is our team fixed them in 4.3, I think :smiley:

@ Dat - Oh gooood news! Thank you

One good news and one bad news … with new SDK Beta3 ???

  • G400 and EMX now working fine with the code and they doesn’t show debug/no debug issue.
  • G120 now (Beta3) is showing same problem the g400 had before (Beta2): in debug program is working / in no-debug program not working. To add more, G120 shows also a strange event firing problem when in debug mode. E.g.: NetworkAddressChanged event and NetworkAvailabilityChanged event are fired only if I stop then run program again. This seems related to ManualResetEvents() and Thread.Sleep() but I must dig into a little more.

The stop/ run issue might be the old “ghost break point” problem, I have all the time with G120 (since VS2012 I think)

Uhh interesting … I will check this suggestion ! Thanks Reinhard!

Try adding



Thread.sleep(10);

At the beginning of your ProgramStarer()

This should help resolve the firing issue.

@ Jay Jay - Thank you for the hint, but it doesn’t solve the issue. In any case G120 has problems with the network.

When the G120 board is NOT in debug, the events fire, but socket doesn’t work. The code I’m using is the same showed on this thread and working fine on G400. The same code in 4.2 works fine on G120.

@ dobova -

Will take a look on G120.

@ Dat - After a little of testing I get event fired using Thread.Sleep(10) @ JayJay trick suggestion, but in a specific point in the constructor of the my TCP class, just after assigning events delegate …



            NetworkChange.NetworkAddressChanged += new NetworkAddressChangedEventHandler(Eth1_NetworkAddressChanged);
            NetworkChange.NetworkAvailabilityChanged += new NetworkAvailabilityChangedEventHandler(Eth1_CableConnectivityChanged);
            Thread.Sleep(10); // <---- it lets the events fire in debug mode
            Eth1 = CreateEthernetInterface();
            Eth1.PhysicalAddress = new byte[] { 0x00, 0xC0, 0x03, 0x00, 0xC1, 0x16 }; // MACADDR: 00-C0-03-00-C1-15
            Eth1.EnableStaticIP(_boardIp, _boardNetmask, _boardGw); // class C net
            string [] DnsAddresses = new string[] { "8.8.8.8" , "192.168.20.1"};
            Eth1.EnableStaticDns(DnsAddresses);
            Eth1.Open();
            NetworkAddressChangeBlocking = new ManualResetEvent(false);
                NetworkAvailablityBlocking = new ManualResetEvent(false);
                do
                {
                    if (!Eth1.CableConnected)
                    {
                        DebugPrint.Print("Ethernet cable is not connected yet.");
                    }
                    else
                        break;
                }
                while (!NetworkAvailablityBlocking.WaitOne(5000, false));

            DebugPrint.Print("Try to set IP addr ....");
            do
            {
                Thread.Sleep(100);
            }
            while (IPAddress.GetDefaultLocalAddress() == IPAddress.Any || !NetworkAddressChangeBlocking.WaitOne(1000, true));
....

@ dobova -

I like this way :smiley:

const bool usedDHCP = false;
static EthernetENC28J60 netif ;
static void main()
{
netif = new EthernetENC28J60(SPI.SPI_module.SPI2, (Cpu.Pin)49, (Cpu.Pin)85, (Cpu.Pin)46); //socket 6 => Corba

if (usedDHCP == false)
            {

              
netif.EnableStaticIP("x.x.x.x", "255.255.255.0", "x.x.x.x");
netif.EnableStaticDns(new string[] { "x.x.x.x", "x.x.x.x" });
            }
            else
            {
            
                if (netif.IsDhcpEnabled == false)
                {
                    netif.EnableDhcp();
                    netif.EnableDynamicDns();
                }
            }
}
 NetworkChange.NetworkAvailabilityChanged += new NetworkAvailabilityChangedEventHandler(NetworkChange_NetworkAvailabilityChanged);
            NetworkChange.NetworkAddressChanged += new NetworkAddressChangedEventHandler(NetworkChange_NetworkAddressChanged);
            netif.Open();
int cnt = 0;
while (isNetworkReady == false)
            {
                Debug.Print("Wait for network active: " + (cnt++));
                Thread.Sleep(1000);
            }
}

static void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
        {
            Debug.Print("Network has changed! ");
        }
        static bool isNetworkReady = false;
        static void NetworkChange_NetworkAddressChanged(object sender, EventArgs e)
        {
            Debug.Print("New address for the Network Interface ");
            Debug.Print("Is DhCp enabled: " + netif.NetworkInterface.IsDhcpEnabled);
            Debug.Print("Is DynamicDnsEnabled enabled: " + netif.NetworkInterface.IsDynamicDnsEnabled);
            Debug.Print("NetworkInterfaceType " + netif.NetworkInterface.NetworkInterfaceType);
            Debug.Print("Network settings:");
            Debug.Print("IP Address: " + netif.NetworkInterface.IPAddress);
            Debug.Print("Subnet Mask: " + netif.NetworkInterface.SubnetMask);
            Debug.Print("Default Gateway: " + netif.NetworkInterface.GatewayAddress);
            Debug.Print("Number of DNS servers:" + netif.NetworkInterface.DnsAddresses.Length);
            for (int i = 0; i < netif.NetworkInterface.DnsAddresses.Length; i++)
                Debug.Print("DNS Server " + i.ToString() + ":" + netif.NetworkInterface.DnsAddresses[i]);
            Debug.Print("------------------------------------------------------");
            if (netif.IPAddress != "0.0.0.0")
            {
                isNetworkReady = true;
            }
        } 

@ Dat - Ok, you beat me… “Take it easy guy!” … Thank you ahahah .
:smiley:

I got the original code from 4.2 that is quite like yours, and I solved the events problem.

Still remain the socket (HttpListener) NOT working if the board is NOT in VS2012 debug mode

@ dobova -

I thought it is only happened on G400 and Hydra, so I only applied the fixed on these devices.
My fault, this will be fixed on next.
:frowning: