清除机器人的DHCP和DNS缓存 [英] Clearing the Dhcp and dns cache of android

查看:807
本文介绍了清除机器人的DHCP和DNS缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法清除Android设备的DNS缓存pogrammatically ??我搜索很多关于谷歌,但没有发现关于这个事情。

Is there way to clear the dns cache of android device pogrammatically??.I search lot on google but didnt find anything regarding this.

推荐答案

作为root用户,在做一个shell:

As root, do in a shell:

NDC解析器flushdefaultif

ndc resolver flushdefaultif

如果你想以编程方式做到这一点,试试这件作品code的:

And if you want to do it programatically, try this piece of code:

    public boolean reboot() {
    Process proc = null;
    try {
        proc = Runtime.getRuntime().exec("su");
        proc.getOutputStream().write(("ndc resolver flushdefaultif").getBytes());
        return proc.waitFor() == 0;
    } catch (IOException e) {
        e.printStackTrace();
    }
    catch (InterruptedException e) {
        e.printStackTrace();
    }

    return false;
}

这篇关于清除机器人的DHCP和DNS缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆