1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * Copyright (c) 2003-2012 by AG-Software 											 *
3  * All Rights Reserved.																 *
4  * Contact information for AG-Software is available at http://www.ag-software.de	 *
5  *																					 *
6  * Licence:																			 *
7  * The agsXMPP SDK is released under a dual licence									 *
8  * agsXMPP can be used under either of two licences									 *
9  * 																					 *
10  * A commercial licence which is probably the most appropriate for commercial 		 *
11  * corporate use and closed source projects. 										 *
12  *																					 *
13  * The GNU Public License (GPL) is probably most appropriate for inclusion in		 *
14  * other open source projects.														 *
15  *																					 *
16  * See README.html for details.														 *
17  *																					 *
18  * For general enquiries visit our website at:										 *
19  * http://www.ag-software.de														 *
20  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
21 
22 
23 using System.Collections.Generic;
24 using System.Net;
25 using System.Net.NetworkInformation;
26 
27 namespace agsXMPP.Net.Dns
28 {
29     /// <summary>
30     /// Summary description for IPConfigurationInformation.
31     /// </summary>
32     public class IPConfigurationInformation
33     {
34         public static List<IPAddress> DnsServers
35         {
36             get
37             {
38                 var dnsServers = new List<IPAddress>();
39                 var interfaces = NetworkInterface.GetAllNetworkInterfaces();
40                 foreach (var eth in interfaces)
41                 {
42                     if (eth.OperationalStatus == OperationalStatus.Up)
43                     {
44                         var ethProperties = eth.GetIPProperties();
45                         var dnsHosts = ethProperties.DnsAddresses;
46                         dnsServers.AddRange(dnsHosts);
47                     }
48                 }
49                 return dnsServers;
50             }
51         }
52     }
53 }