https://bugzilla.novell.com/show_bug.cgi?id=450211
Summary: Can't get the DNS Server Address Product: Mono: Class Libraries Version: 2.0.x Platform: All OS/Version: Linux Status: NEW Severity: Normal Priority: P5 - None Component: System AssignedTo: mono-bugs@lists.ximian.com ReportedBy: [EMAIL PROTECTED] QAContact: mono-bugs@lists.ximian.com Found By: --- Description of Problem: I want to get the default DNS server address currently used. In Windows and .Net 2.0 , I can get it with the following code: public static IPAddressCollection DiscoverDnsServerAddresses() { NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces(); foreach (NetworkInterface nic in nics) { if ( (nic.OperationalStatus == OperationalStatus.Up) && (nic.Speed > 0) && (nic.NetworkInterfaceType != NetworkInterfaceType.Loopback)&& (nic.NetworkInterfaceType != NetworkInterfaceType.Tunnel)) { return nic.GetIPProperties().DnsAddresses; } } return null; } But in mono, nic.GetIPProperties().DnsAddresses; returns a collection with nothing in it. I guess it's because that in Linux DNS server address is not configured for each "Network Interface", but globally by /etc/resolv.conf Thus parsing /etc/resolv.conf will solve the problem, but in a really ugly way. I think it will be much better if nic.GetIPProperties().DnsAddresses returns the list of DNS servers currently used by the system in Linux. And the corresponding code will be portable. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. _______________________________________________ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs