Anybody got an example of obtaining your IP address after wifi connection?

Looking to give the user an option to see the meadow IP on a led screen after a successful connection and I’m not finding that in the docs.

Howdy!

This isn’t currently available, but we are looking to add it soon. Keep an eye on the release notes!

-Pete

Thanks. I’m working on a TCP/UDP listener to send commands to meadow. Plan to use multiple meadows so IP will be important but I can use some sort of “phone home” to help associate the IP and MAC with the Meadow board for now.

        void ConnectToWifi()
        {
            Device.InitWiFiAdapter().Wait();

            if (Device.WiFiAdapter.Connect("<WIFI Network SSID>", "<Wifi Password>").ConnectionStatus != ConnectionStatus.Success)
            {
                throw new Exception("Cannot connect to network, application halted.");
            }

            IPAddress[] IPS = Dns.GetHostAddresses(Dns.GetHostName());

            foreach (IPAddress ip in IPS)
            {
                Console.WriteLine("IP address: " + ip);
            }
        }

I’ve got this code that spits out the IP address to the Console in debug. You might be able to use that?

That worked great, thanks

2 Likes

Updated to b4.5 and this is working for me:

Console.WriteLine( $“IP Address is: {Device.WiFiAdapter.IpAddress}” );

1 Like

What version of the firmware are you using? Looks like rev 5 does not support the co-processor yet…

thx

The co-processor is supported at version 5, in fact the networking classes in the .NET framework has been working since the 4.x releases. There are occasional problems flashing the firmware to the ESP and that makes it look like things are not working correctly,

Regards,
Mark

Thx, yes I was able to get things working correctly.