在node.js上获取客户端的MAC地址 [英] Getting client's MAC address on node.js

查看:1967
本文介绍了在node.js上获取客户端的MAC地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在Node.js上找到客户端的mac地址?我一直在搜索它,但是我发现了node-sigar项目,但是它没有用,因为它引发了找不到模块./build/Release/sigar"错误.

解决方案

除非您的代码与客户端在同一LAN段上运行,否则您将无法获取客户端的MAC地址.您可能需要使用命令行工具或本机支持才能获得本地LAN网段上的地址.

对于nodejs: https://npmjs.org/search?q=Arp

如果尝试获取远程客户端的MAC地址,则最终获得的路由器地址的可能性将更大.

Is there a way to find client's mac address on Node.js? I have been searching about it and i found node-sigar project but it didn't works because it throws a "cannot find module ./build/Release/sigar" error.

解决方案

Unless your code is running on the same LAN segment as the client, you cannot obtain the MAC address of a client. You'd need to likely shell out to a command line tool or native support to gain addresses on the local LAN segment.

For nodejs: https://npmjs.org/search?q=Arp

If you try to get remote clients' MAC addresses, you'll end up with the address of a router more than likely.

这篇关于在node.js上获取客户端的MAC地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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