Main Site Documentation

Cobra Wifi


I have used the example from the documentation to create a wifi connection.

I have checked that the wifi SSID is available, that I have joined it … however, I do not get a IP address (DHCP)



            netif.Join(ssid, password);

while (netif.IPAddress == “”)
//sleep etc

never returns an address …



@ Robert24 - Can you try to connect to a different router or turning off security?


I’m able to simulate this with this code:

using GHI.Networking;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using Microsoft.SPOT.Net.NetworkInformation;
using G120 = GHI.Pins.G120;
using System.Threading; 

public partial class Program
    private static WiFiRS9110 netif;

    public static void Main()
        NetworkChange.NetworkAvailabilityChanged += NetworkChange_NetworkAvailabilityChanged;
        NetworkChange.NetworkAddressChanged += NetworkChange_NetworkAddressChanged;

        netif = new WiFiRS9110(SPI.SPI_module.SPI2, G120.P1_10, G120.P2_11, G120.P1_9);
        netif.Join("WLANEmrol2", "***");

        while (true)
                Debug.Print("Ip address in main : " + netif.IPAddress); 

    private static void NetworkChange_NetworkAddressChanged(object sender, Microsoft.SPOT.EventArgs e)
        Debug.Print("Network address changed to " + netif.IPAddress);


        if (netif.IPAddress != "")
            //The network is now ready to use.
            Debug.Print("Connected - IP=" + netif.IPAddress); 

    private static void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
        Debug.Print("Network availability: " + e.IsAvailable.ToString());

Output in debug window shows a delay :

Network availability: True
Network address changed to
Ip address in main :
Ip address in main :
Ip address in main :
Ip address in main :
Ip address in main :

The address stay’s in main as long as the sleep in NetworkAddressChanged is set, then it switching to the assigned address and NetworkChange_NetworkAddressChanged is not trigered again.


I do not have another router in range … if I use static address; it works ok.

I have also duplicated David’s code and still no ipaddress from DHCP.

David are you using 4.3?


Yes, i used 4.3 R5 on a Cobra II Rev B.


@ Robert24 - You get no ip address at all or also “delayed” ?


I have the same issue on 4.3 Cobra II WiFi. There is no “delay” - it never gets an address. I think I’m one release back from current. Static IP works fine.


@ ransomhall - Is it actual not getting a address with DHCP or is the NetworkChange_NetworkAddressChanged event not trigered?


@ david - when settings for DHCP the networkAddressChanged never fires … if I set a static address it fires …


@ Robert24 - Have long have you let it sit trying to get an address? Do you see an address assigned in your router?


@ John - Have left it forever but nothing … DHCP is managed by our windows server!


@ John and there appears to be no entry for the cobra II … all entries can be accounted for?


@ Robert24 - Can you do a wireshark capture on your DHCP server to see what sort of traffic is going between the server and the Cobra?


Another first; I will download wireshark and attempt to monitor; maybe need some hints as I have never used it before!