mirror of
https://github.com/netbirdio/IronRDP.git
synced 2026-05-22 18:43:12 -07:00
fix(dotnet): support IP address server names
This commit is contained in:
committed by
Benoît Cortier
parent
a18fb34b6d
commit
26421c7469
@@ -197,8 +197,15 @@ public class Connection
|
||||
|
||||
static async Task<NetworkStream> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user