Network Utility Methods Part 2: Retrieving Local and Public IP Addresses (C# .NET Core)

Let’s finish off the NetworkUtilities class from the previous post with a set of methods that retrieve the private (local) and public (external) IP addresses of the local machine. All source files can be downloaded individually as .cs files or as a single zip file containing the entire class at the gist link below: Network Utilities: IP Parsing/Retrieving (C# .NET Core 2.0) [gist.github.com] Retrieve Local IP Address (Requires Internet) The method below, GetLocalIPv4AddressRequiresInternet, retrieves the local IP address, and does so in a fairly clever way (IMHO).... Read More