08-10-2022 12:08 AM
Is there a way to use System Configuration to get and set the "localhost" IP Address?
I'm attempting to create a tool to collect all networked items (including localhost), and then allow the use to change the IP address (or randomly set them all).
Right now I'm having great luck with everything EXCEPT localhost..... I'm sure I'm just missing something silly, or maybe this isn't possible but I thought I'd ask.
I understand that I can do this to gather the localhost IP and Alias.
But I'm wanting to be able to pull in it's properties using System Configuration so that I don't have to have a separate chunk of code for localhost.
I'm currently doing this for everything else.... to gather that is.
I know I can also utilize the following to get this information for everything BUT localhost.
Thanks
08-10-2022 01:12 AM - edited 08-10-2022 01:16 AM
This seems kinda hokey... but is closer to what I'm hoping to achieve as the output, just seems like I'm doing it wrong though.
Eventually I want to be able to take this list of IPs, and then allow the user to edit them and update them all, it's a security feature.
Output
08-10-2022 04:33 AM - edited 08-10-2022 04:35 AM
You can't change the IP address for "localhost", it's by definition 127.0.0.1 (for IPv4, IPv6 is not as simple).
But the System Configuration API uses MyComputer as local system identifier and an empty resource string should be synonym to that. Of course the local system can and nowadays almost certainly does have multiple network adapters and hence network addresses. One of them is the primary, and the others are secondary.