3 using System.Net.Sockets;
5 using System.Threading.Tasks;
6 using System.Security.Permissions;
7 using System.Diagnostics.CodeAnalysis;
9 namespace System.Net.NetworkInformation
12 public abstract class IPGlobalProperties
14 public static IPGlobalProperties GetIPGlobalProperties()
16 (new NetworkInformationPermission(NetworkInformationAccess.Read)).Demand();
17 return new SystemIPGlobalProperties();
20 internal static IPGlobalProperties InternalGetIPGlobalProperties()
22 return new SystemIPGlobalProperties();
25 /// Gets the Active Udp Listeners on this machine
26 public abstract IPEndPoint[] GetActiveUdpListeners();
28 /// Gets the Active Tcp Listeners on this machine
29 public abstract IPEndPoint[] GetActiveTcpListeners ();
31 /// Gets the Active Udp Listeners on this machine
32 public abstract TcpConnectionInformation[] GetActiveTcpConnections();
34 /// Gets the Dynamic Host Configuration Protocol (DHCP) scope name.
35 public abstract string DhcpScopeName {get;}
37 /// Gets the domain in which the local computer is registered.
39 public abstract string DomainName {get;}
41 /// Gets the host name for the local computer.
43 public abstract string HostName {get;}
45 /// Gets a bool value that specifies whether the local computer is acting as a Windows Internet Name Service (WINS) proxy.
46 public abstract bool IsWinsProxy {get;}
48 /// Gets the Network Basic Input/Output System (NetBIOS) node type of the local computer.
49 public abstract NetBiosNodeType NodeType{get;}
52 public abstract TcpStatistics GetTcpIPv4Statistics();
54 public abstract TcpStatistics GetTcpIPv6Statistics();
56 /// Provides Internet Control Message Protocol (ICMP) version 4 statistical data for the local computer.
57 /// Provides User Datagram Protocol (UDP) statistical data for the local computer.
59 public abstract UdpStatistics GetUdpIPv4Statistics();
60 public abstract UdpStatistics GetUdpIPv6Statistics();
62 /// Provides Internet Control Message Protocol (ICMP) version 4 statistical data for the local computer.
64 public abstract IcmpV4Statistics GetIcmpV4Statistics();
66 /// Provides Internet Control Message Protocol (ICMP) version 6 statistical data for the local computer.
68 public abstract IcmpV6Statistics GetIcmpV6Statistics();
70 /// Provides Internet Protocol (IP) statistical data for the local computer.
71 public abstract IPGlobalStatistics GetIPv4GlobalStatistics();
72 public abstract IPGlobalStatistics GetIPv6GlobalStatistics();
74 /// Returns a list of all unicast IP addresses after ensuring they are all stable
75 public virtual UnicastIPAddressInformationCollection GetUnicastAddresses()
77 throw ExceptionHelper.MethodNotImplementedException;
80 public virtual IAsyncResult BeginGetUnicastAddresses(AsyncCallback callback, object state)
82 throw ExceptionHelper.MethodNotImplementedException;
85 public virtual UnicastIPAddressInformationCollection EndGetUnicastAddresses(IAsyncResult asyncResult)
87 throw ExceptionHelper.MethodNotImplementedException;
90 //************* Task-based async public methods *************************
91 [HostProtection(ExternalThreading = true)]
92 [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Unicast")]
93 public virtual Task<UnicastIPAddressInformationCollection> GetUnicastAddressesAsync()
95 return Task<UnicastIPAddressInformationCollection>.Factory.FromAsync(BeginGetUnicastAddresses, EndGetUnicastAddresses, null);