[英]How to get MAC address of a client device with connect mobile data in Xamarin.Forms?
In my client-server-solution I need the MAC addresses of frontend devices, running my Xamarin.Forms app.在我的客户端-服务器-解决方案中,我需要前端设备的 MAC 地址,运行我的 Xamarin.Forms 应用程序。 Currently I just have get Mac Address connected by
Wifi
is correct in info about device.目前,我刚刚通过
Wifi
连接的 Mac 地址在有关设备的信息中是正确的。 But, I used mobile data
then get Mac Address in device not correct.但是,我使用
mobile data
然后在设备中获取的 Mac 地址不正确。
var lstAllNetWorkInfaces = NetworkInterface.GetAllNetworkInterfaces();
var ni = lstAllNetWorkInfaces.FirstOrDefault(intf => (intf.OperationalStatus == OperationalStatus.Up)
&& (intf.NetworkInterfaceType == NetworkInterfaceType.Wireless80211
|| intf.NetworkInterfaceType == NetworkInterfaceType.Ethernet));
var hw = ni.GetPhysicalAddress();
physicalWifiAddress = string.Join(":", (from ma in hw.GetAddressBytes() select ma.ToString("X2")).ToArray());
Please let me know if there's a bug or if you found a better solution.请让我知道是否存在错误或您是否找到了更好的解决方案。
" Layer 2 (Data Link) - It provides a reliable signaling link between the mobile station (MS) and the network. Protocol is based on the LAPDm of ISDN " “第 2 层(数据链路) - 它在移动台 (MS) 和网络之间提供可靠的信令链路。协议基于 ISDN 的 LAPDm ”
Source is Does the OSI model also apply to mobile networks?来源是OSI model 是否也适用于移动网络? .
.
So in 2G networks ARP is not used so MAC addresses are not a thing in that scenario.所以在 2G 网络中不使用 ARP,所以 MAC 地址在那种情况下不是一个东西。 You should consider other client authentication method.
您应该考虑其他客户端身份验证方法。
I would suggest client side certificates, they work in any device.我建议客户端证书,它们适用于任何设备。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.