求一个实现网络拓扑的JAVA程序

Python016

求一个实现网络拓扑的JAVA程序,第1张

import java.io.File

import java.io.FileNotFoundException

import java.io.FileOutputStream

import java.io.IOException

import java.nio.ByteBuffer

import java.nio.channels.FileChannel

public class Io {

public static void main(String[] args) {

//没有用excel表格随便用了一个txt文本文档你参考下

File fl=new File("src/test.txt")//输出目的文件,没有文件会自动创建

try {

FileOutputStream out=new FileOutputStream(fl)//输出流

FileChannel Channel=out.getChannel()

ByteBuffer buff= ByteBuffer.allocate(100)//缓冲区长度

byte by[]="Hello 文本内容进行输出测试 ".getBytes()//设置内容

buff.put(by)//把内容放进缓冲区

buff.flip()

try {

Channel.write(buff)// 将字节序列从给定的缓冲区写入此通道

Channel.close()//关闭此通道

} catch (IOException e) {

// TODO Auto-generated catch block

e.printStackTrace()

}

} catch (FileNotFoundException e) {

// TODO Auto-generated catch block

e.printStackTrace()

}

}

}

ObjectSNMP是采用Java技术和SNMP技术实现的网络拓扑发现产品,目前的功能如下:全网设备发现:可以按网络号、IP范围、多个网络范围内,自动搜索发现设备,获取设备的基本信息、设备类型(交换、路由、路由交换、终端设备、厂商特有类型等)