当前位置: 代码迷 >> Java相关 >> 求用java自动重启自家路由器代码,用批处理也可以。该怎么解决
  详细解决方案

求用java自动重启自家路由器代码,用批处理也可以。该怎么解决

热度:7994   发布时间:2013-02-25 21:46:26.0
求用java自动重启自家路由器代码,用批处理也可以。
可以用http://192.168.1.1 进入,需要输入密码。 可以修改进入的端口号。

求各位大侠给个代码。。。。谢谢!!!

------解决方案--------------------------------------------------------
呃,没做过。帮顶了,祝楼主好运啊
------解决方案--------------------------------------------------------
Java code
package net;import java.net.Authenticator;import java.net.PasswordAuthentication;public class DialogAuthenticator extends Authenticator {    private static final DialogAuthenticator instance = new DialogAuthenticator();    private DialogAuthenticator() {        super();    }    public static DialogAuthenticator getInstance() {        return instance;    }    @Override    protected PasswordAuthentication getPasswordAuthentication() {        String site = this.getRequestingSite().getHostAddress();        if (site.trim().indexOf("127.0.0.1") != -1) {            return new PasswordAuthentication("admin", "admin".toCharArray());        } else {            return null;        }    }}
  相关解决方案