mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Catch when host is already an IP address.
This commit is contained in:
@@ -54,10 +54,13 @@ namespace Aaru.Devices.Remote
|
||||
public Remote(string host)
|
||||
{
|
||||
_host = host;
|
||||
IPHostEntry ipHostEntry = Dns.GetHostEntry(host);
|
||||
|
||||
IPAddress ipAddress =
|
||||
ipHostEntry.AddressList.FirstOrDefault(a => a.AddressFamily == AddressFamily.InterNetwork);
|
||||
if(!IPAddress.TryParse(host, out IPAddress ipAddress))
|
||||
{
|
||||
IPHostEntry ipHostEntry = Dns.GetHostEntry(host);
|
||||
|
||||
ipAddress = ipHostEntry.AddressList.FirstOrDefault(a => a.AddressFamily == AddressFamily.InterNetwork);
|
||||
}
|
||||
|
||||
if(ipAddress is null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user