[英]detecting devices connected to my network
I need Java code to detect current connected devices to my network. 我需要Java代码来检测当前连接到网络的设备。 I tried the following idea : - for all possible addresses check if this address is connected ( 254 loop ) - to speed up this process I created a thread for each check to make them run in parallel
我尝试了以下想法:-对于所有可能的地址,检查该地址是否已连接(254循环)-为了加快此过程,我为每次检查创建了一个线程,以使其并行运行
Is there any way more efficient ?? 有什么办法更有效吗?
Well there are lots of ways of detecting networked devices and you give no specifics on the nature of your situation. 嗯,有很多检测网络设备的方法,您没有提供具体情况的详细信息。
The simplest (and most simplistic) approach I can think of would be to ping the broadcast address of your IP network and then consult the system's ARP table. 我能想到的最简单(也是最简单)的方法是对IP网络的广播地址执行ping操作,然后查阅系统的ARP表。 Unfortunately I have no particular strategy for accessing the ARP table from Java to suggest.
不幸的是,我没有从Java访问ARP表的具体建议。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.