当手机在本地网络中时,它具有ip 192.168.0.x
,当它在外部无线接入时,它使用移动网络提供的互联网连接(当你在手机内有SIM时访问互联网) .
如何通过C#确定当时使用哪种连接?
编辑:
NetworkInterfaceInfo netInterfaceInfo = socket.GetCurrentNetworkInterface();
var type = netInterfaceInfo.InterfaceType;
var subType = netInterfaceInfo.InterfaceSubtype;
1 回答
您可以尝试此方法来检查网络状态: