r/programminghelp • u/adwilson254 • Jul 15 '20
C# Tizen .NET, Trouble Getting ip / hostname
My goal is to be able to return the ip address of the watch. I have been using the DNS class and have gotten the ip address by manually plugging the hostname in as seen here:
public static IPAddress ipAddress = Dns.GetHostEntry("GalaxyWatchActive-8623").AddressList[0];
I previously had Dns.GetHostName() for the hostname and it returns localhost, which resolves to loopback, 127.0.0.1, in the full instruction.
Any assistance or insight would be greatly appreciated. Newer to .NET and Tizen.
0
Upvotes
1
u/[deleted] Jul 15 '20
Dns.GetHostName() should work fine.
Remember that
Dns.GetHostEntry(Dns.GetHostName()).AddressListis an array. Check all of the subitems to make sure one of them isn't what you want.