zoukankan      html  css  js  c++  java
  • 局域网活跃主机扫描

     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 }
  • 相关阅读:
    ubuntu安装
    学习资料

    disksim-3.0 with flashsim 安装
    STL
    存储引擎
    数据库索引
    数据库表、字段设计
    查询SQL优化
    导航栏实现
  • 原文地址:https://www.cnblogs.com/silianbo/p/4628745.html
Copyright © 2011-2022 走看看