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

◆ GetHostName()

static unsafe string System.Net.NameResolutionPal.GetHostName ( )
inlinestatic

Definition at line 252 of file NameResolutionPal.cs.

253 {
254 global::Interop.Winsock.EnsureInitialized();
255 byte* ptr = stackalloc byte[256];
256 SocketError socketError = global::Interop.Winsock.gethostname(ptr, 256);
257 if (socketError != 0)
258 {
259 if (System.Net.NetEventSource.Log.IsEnabled())
260 {
261 System.Net.NetEventSource.Error(null, $"GetHostName failed with {socketError}", "GetHostName");
262 }
263 throw new SocketException();
264 }
265 return new string((sbyte*)ptr);
266 }
static readonly System.Net.NetEventSource Log
static void Error(object thisOrContextObject, FormattableString formattableString, [CallerMemberName] string memberName=null)

References System.Net.NetEventSource.Error(), and System.Net.NetEventSource.Log.

Referenced by System.Net.Dns.GetHostName().