获取网络中所有的系统Ip地址 [英] To get all the system Ip Address which are in the network

查看:81
本文介绍了获取网络中所有的系统Ip地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全部,

我想获取网络中的IP地址和操作系统类型,如何通过JAVA做到这一点.通过示例Java代码帮助我

Hai All,

I want to get ip address and the type of operating system(OS) in a network.How can do it through JAVA. Help me through sample JAVA code

推荐答案

您可能需要遍历子网中的所有地址,然后向该地址发送"ping".如果它响应,则您知道该地址处有一个设备.我不知道如何找到设备上的操作系统.
You would probably need to loop through all the addresses in your subnet and send a ''ping'' to the address. If it responds then you know there is a device at that address. I don''t know how you could find out what OS is on the device.


您可以ping子网的广播地址,然后在命令行上调用"arp -a" .确保您使用的实际广播地址不只是255.255.255.255,否则ping会给您一个错误(在Windows计算机上).

由于您要求提供代码示例,因此我将您链接到 [
You can ping the broadcast address of the subnet and then call "arp -a" on the command line. Make sure you use the actual broadcast address not just 255.255.255.255 or ping will give you an error (on a windows machine).

Since you asked for a code example I''ll link you to this[^], which shows how to use the OS command line interface from Java. I don''t think Java has native support for a ping class or an arp command. However, I think the ping and arp commands are the same for Windows, Unix, and Linux, at least for what you want to do.


这篇关于获取网络中所有的系统Ip地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆