Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetHostEntry() [3/3]

static IPHostEntry System.Net.Dns.GetHostEntry ( string hostNameOrAddress,
AddressFamily family )
inlinestatic

Definition at line 63 of file Dns.cs.

64 {
65 if (hostNameOrAddress == null)
66 {
67 throw new ArgumentNullException("hostNameOrAddress");
68 }
69 IPHostEntry hostEntryCore;
70 if (IPAddress.TryParse(hostNameOrAddress, out IPAddress address))
71 {
72 if (address.Equals(IPAddress.Any) || address.Equals(IPAddress.IPv6Any))
73 {
74 if (System.Net.NetEventSource.Log.IsEnabled())
75 {
76 System.Net.NetEventSource.Error(address, $"Invalid address '{address}'", "GetHostEntry");
77 }
78 throw new ArgumentException(System.SR.Format(System.SR.net_invalid_ip_addr, "hostNameOrAddress"));
79 }
81 }
82 else
83 {
85 }
86 if (System.Net.NetEventSource.Log.IsEnabled())
87 {
88 System.Net.NetEventSource.Info(hostNameOrAddress, $"{hostEntryCore} with {hostEntryCore.AddressList.Length} entries", "GetHostEntry");
89 }
90 return hostEntryCore;
91 }
static IPHostEntry GetHostEntryCore(string hostName, AddressFamily addressFamily, ValueStopwatch stopwatch=default(ValueStopwatch))
Definition Dns.cs:357
static readonly System.Net.NetEventSource Log
static void Info(object thisOrContextObject, FormattableString formattableString=null, [CallerMemberName] string memberName=null)
static void Error(object thisOrContextObject, FormattableString formattableString, [CallerMemberName] string memberName=null)
static string net_invalid_ip_addr
Definition SR.cs:16
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
Definition SR.cs:7

References System.Net.IPAddress.Any, System.Net.NetEventSource.Error(), System.SR.Format(), System.Net.Dns.GetHostEntryCore(), System.Net.NetEventSource.Info(), System.Net.IPAddress.IPv6Any, System.Net.NetEventSource.Log, System.SR.net_invalid_ip_addr, and System.Net.IPAddress.TryParse().