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

◆ GetHostEntryOrAddressesCore() [2/2]

static object System.Net.Dns.GetHostEntryOrAddressesCore ( string hostName,
bool justAddresses,
AddressFamily addressFamily,
ValueStopwatch stopwatch )
inlinestaticprivate

Definition at line 367 of file Dns.cs.

368 {
369 ValidateHostName(hostName);
370 if (!stopwatch.IsActive)
371 {
372 stopwatch = NameResolutionTelemetry.Log.BeforeResolution(hostName);
373 }
374 object result;
375 try
376 {
377 string hostName2;
378 string[] aliases;
379 IPAddress[] addresses;
380 int nativeErrorCode;
381 SocketError socketError = NameResolutionPal.TryGetAddrInfo(hostName, justAddresses, addressFamily, out hostName2, out aliases, out addresses, out nativeErrorCode);
382 if (socketError != 0)
383 {
384 if (System.Net.NetEventSource.Log.IsEnabled())
385 {
386 System.Net.NetEventSource.Error(hostName, $"{hostName} DNS lookup failed with {socketError}", "GetHostEntryOrAddressesCore");
387 }
389 }
390 result = (justAddresses ? ((object)addresses) : ((object)new IPHostEntry
391 {
392 AddressList = addresses,
393 HostName = hostName2,
394 Aliases = aliases
395 }));
396 }
397 catch when (LogFailure(stopwatch))
398 {
399 throw;
400 }
401 NameResolutionTelemetry.Log.AfterResolution(stopwatch, successful: true);
402 return result;
403 }
static void ValidateHostName(string hostName)
Definition Dns.cs:591
static bool LogFailure(ValueStopwatch stopwatch)
Definition Dns.cs:599
static SocketException CreateSocketException(SocketError errorCode, int platformError)
static readonly System.Net.NetEventSource Log
static void Error(object thisOrContextObject, FormattableString formattableString, [CallerMemberName] string memberName=null)

References System.Net.Internals.SocketExceptionFactory.CreateSocketException(), System.Net.NetEventSource.Error(), System.Net.NetEventSource.Log, System.Net.NameResolutionTelemetry.Log, System.Net.Dns.LogFailure(), System.Net.NameResolutionPal.TryGetAddrInfo(), and System.Net.Dns.ValidateHostName().

Referenced by System.Net.Dns.GetHostAddressesCore(), System.Net.Dns.GetHostAddressesCore(), System.Net.Dns.GetHostEntryCore(), and System.Net.Dns.GetHostEntryCore().