扫描整个网段的多线程程序Java认证考试
文章作者 100test 发表时间 2010:03:20 09:11:25
来源 100Test.Com百考试题网
扫描500个IP10秒钟左右, 一个IP等待0.3秒
用java写的过程编程,供参考:
package steeven.
import java.sql.*.
import java.io.*.
import java.util.*.
import java.text.*.
import javax.servlet.http.*.
public class Ip extends Common implements Runnable{
public String ip. // IP, 用户名, 主机名
ResultSet list. // 分页显示的记录集
public Ip cur. // 分页显示的当前记录
static public Hashtable ping = new Hashtable(). //ping 后的结果集
static int threadCount = 0. //当前线程的数量, 防止过多线程摧毁电脑
public Ip() {}
public Ip(String ip){
this.ip=ip.
Thread r = new Thread(this).
r.start().
}
public static void Ping(String ip) throws Exception{
//最多30个线程
while(threadCount