Node.js - 本地网络设备列表

劳尔德

是否可以获取局域网中连接的设备列表?我想确定我的打印机是否已连接。感谢您的回答

劳尔德

可能的解决方案

var ping = require('ping');
var hosts = ['10.0.0.2','10.0.0.3']; <--- printer A and B addresses
hosts.forEach(function(host){
    ping.sys.probe(host, function(isAlive){
        var msg = isAlive ? 'host ' + host + ' is connected' : 'host ' + host + ' is not connected';
        console.log(msg);
    });
});

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章