From 3f9a0631f0e127b83c27b3cbbbe3d0c3d71c32fd Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sat, 17 Oct 2020 00:19:57 +0100 Subject: [PATCH] Catch when host is already an IP address. --- Aaru.Devices/Remote/Remote.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Aaru.Devices/Remote/Remote.cs b/Aaru.Devices/Remote/Remote.cs index 2fe6a2404..0e738ee9f 100644 --- a/Aaru.Devices/Remote/Remote.cs +++ b/Aaru.Devices/Remote/Remote.cs @@ -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) {