diff --git a/ffi/dotnet/Devolutions.IronRdp/src/Connection.cs b/ffi/dotnet/Devolutions.IronRdp/src/Connection.cs index 7e810e74..d1cd0c9d 100644 --- a/ffi/dotnet/Devolutions.IronRdp/src/Connection.cs +++ b/ffi/dotnet/Devolutions.IronRdp/src/Connection.cs @@ -197,8 +197,15 @@ public class Connection static async Task CreateTcpConnection(String servername, int port) { - IPHostEntry ipHostInfo = await Dns.GetHostEntryAsync(servername); - IPAddress ipAddress = ipHostInfo.AddressList[0]; + IPAddress ipAddress; + + try { + ipAddress = IPAddress.Parse(servername); + } catch (FormatException) { + IPHostEntry ipHostInfo = await Dns.GetHostEntryAsync(servername); + ipAddress = ipHostInfo.AddressList[0]; + } + IPEndPoint ipEndPoint = new(ipAddress, port); TcpClient client = new TcpClient(); @@ -220,4 +227,4 @@ public static class Utils vecU8.Fill(buffer); return buffer; } -} \ No newline at end of file +}