How to get the IP Address of a device in .NETCF

Here’s something I see asked every now and then in the community forums. The solution is a one liner that looks like this:

IPAddress[] addresses = Dns.GetHostEntry(Dns.GetHostName()).AddressList;

The code above retrieves the IP addresses for each connected network adapter of the device. The Dns and IPAddress classes belong to the System.Net namespace.

One thought on “How to get the IP Address of a device in .NETCF

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top