Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I recommend <a href="http://www.xbill.org/dnsjava/" rel="nofollow">dnsjava</a> for complex DNS use on Android. Let's see how dnsjava determines the current active DNS server for the connection. <a href="http://dnsjava.svn.sourceforge.net/viewvc/dnsjava/trunk/org/xbill/DNS/ResolverConfig.java?revision=1665&amp;view=markup" rel="nofollow">From dnsjava ResolverConfig.java:428</a>:</p> <pre><code>/** * Parses the output of getprop, which is the only way to get DNS * info on Android. getprop might disappear in future releases, so * this code comes with a use-by date. */ private void findAndroid() { // This originally looked for all lines containing .dns; but // http://code.google.com/p/android/issues/detail?id=2207#c73 // indicates that net.dns* should always be the active nameservers, so // we use those. String re1 = "^\\d+(\\.\\d+){3}$"; String re2 = "^[0-9a-f]+(:[0-9a-f]*)+:[0-9a-f]+$"; try { ArrayList lserver = new ArrayList(); ArrayList lsearch = new ArrayList(); String line; Process p = Runtime.getRuntime().exec("getprop"); InputStream in = p.getInputStream(); InputStreamReader isr = new InputStreamReader(in); BufferedReader br = new BufferedReader(isr); while ((line = br.readLine()) != null ) { StringTokenizer t = new StringTokenizer(line, ":"); String name = t.nextToken(); if (name.indexOf( "net.dns" ) &gt; -1) { String v = t.nextToken(); v = v.replaceAll("[ \\[\\]]", ""); if ((v.matches(re1) || v.matches(re2)) &amp;&amp; !lserver.contains(v)) lserver.add(v); } } configureFromLists(lserver, lsearch); } catch ( Exception e ) { // ignore resolutely } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload