首页 > 其他 > 详细

局域网活跃主机扫描

时间:2015-07-08 00:21:03      阅读:322      评论:0      收藏:0      [点我收藏+]
 1 /*
 2  * To change this license header, choose License Headers in Project Properties.
 3  * To change this template file, choose Tools | Templates
 4  * and open the template in the editor.
 5  */
 6 package example;
 7 
 8 import java.io.IOException;
 9 import java.net.InetAddress;
10 
11 /**
12  *
13  * @author silianbo
14  */
15 public class test {
16 
17     public static void main(String[] args) throws IOException {
18         String ip = "192.168.1.";
19         for (int i = 1; i < 256; i++) {
20             String host = ip + i;
21             InetAddress ia = InetAddress.getByName(host);
22             boolean bool = ia.isReachable(1500);
23             if (bool) {
24                 System.out.println("主机: " + host + " 可用");
25             }
26 
27         }
28 
29     }
30 }

 

局域网活跃主机扫描

原文:http://www.cnblogs.com/silianbo/p/4628745.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!