fork(23) download
  1. using System;
  2. using System.Net;
  3. using System.Net.NetworkInformation;
  4.  
  5. public class Test
  6. {
  7. static string GetFQDN()
  8. {
  9. string domainName = IPGlobalProperties.GetIPGlobalProperties().DomainName;
  10. string hostName = Dns.GetHostName();
  11.  
  12. if(!hostName.EndsWith(domainName))
  13. {
  14. hostName += "." + domainName;
  15. }
  16.  
  17. return hostName;
  18. }
  19.  
  20. public static void Main()
  21. {
  22. Console.WriteLine("GetFQDN() => \"{0}\"", GetFQDN());
  23. Console.WriteLine("GetHostEntry() => \"{0}\"", System.Net.Dns.GetHostEntry("localhost").HostName);
  24. Console.WriteLine("Resolve() => \"{0}\"", System.Net.Dns.Resolve("localhost").HostName);
  25.  
  26. }
  27. }
Success #stdin #stdout 0.17s 40680KB
stdin
Standard input is empty
stdout
GetFQDN() => "checker"
GetHostEntry() => "localhost"
Resolve() => "localhost"