confused screaming
This commit is contained in:
20
PVHelpers/NetEndPointFromHostname.cs
Normal file
20
PVHelpers/NetEndPointFromHostname.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Net;
|
||||
|
||||
namespace PVHelpers
|
||||
{
|
||||
public class NetEndPointFromHostname(String hostname, Int32 port) : INetEndPoint
|
||||
{
|
||||
public String Hostname { get; } = hostname;
|
||||
public IPEndPoint EndPoint => new(this.Address, this.Port);
|
||||
|
||||
public IPAddress Address
|
||||
{
|
||||
get
|
||||
{
|
||||
IPHostEntry entry = Dns.GetHostEntry(this.Hostname);
|
||||
return entry.AddressList[0];
|
||||
}
|
||||
}
|
||||
public Int32 Port { get; } = port;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user