当前位置:网站首页>Methods for obtaining some information of equipment
Methods for obtaining some information of equipment
2022-06-25 06:14:00 【weixin_ forty-three million seven hundred and fifty-four thousa】
Get the system Ip
public enum ADDRESSFAM
{
IPv4, IPv6
}
/// <summary>
/// Get local IP
/// </summary>
/// <param name="Addfam"> To obtain the IP type </param>
/// <returns></returns>
public string GetIP(ADDRESSFAM Addfam)
{
if (Addfam == ADDRESSFAM.IPv6 && !Socket.OSSupportsIPv6)
{
return null;
}
string output = "";
foreach (NetworkInterface item in NetworkInterface.GetAllNetworkInterfaces())
{
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
NetworkInterfaceType _type1 = NetworkInterfaceType.Wireless80211;
NetworkInterfaceType _type2 = NetworkInterfaceType.Ethernet;
if ((item.NetworkInterfaceType == _type1 || item.NetworkInterfaceType == _type2) && item.OperationalStatus == OperationalStatus.Up)
#endif
{
foreach (UnicastIPAddressInformation ip in item.GetIPProperties().UnicastAddresses)
{
//IPv4
if (Addfam == ADDRESSFAM.IPv4)
{
if (ip.Address.AddressFamily == AddressFamily.InterNetwork)
{
output = ip.Address.ToString();
//Debug.Log("IP:" + output);
}
}
//IPv6
else if (Addfam == ADDRESSFAM.IPv6)
{
if (ip.Address.AddressFamily == AddressFamily.InterNetworkV6)
{
output = ip.Address.ToString();
}
}
}
}
}
return output;
}
边栏推荐
- IQ debugging of Hisilicon platform ISP and image (1)
- PAT (Advanced Level) Practice 1025
- Data7202 statistical analysis
- Getting started with mongodb
- Handling skills of SQL optimization (2)
- Technology inventory: past, present and future of Message Oriented Middleware
- C simple operation mongodb
- Getting started with Silverlight development 1
- Global and China financial guarantee marketing strategy and channel dynamic construction report 2022
- SAP ui5 beginner tutorial No. 27 - unit test tool quNit introduction trial version for SAP ui5 application
猜你喜欢
DOM proficient? What is the difference between node and elment?
Location object
Linus' speech recordings, which were lost in 1994, were made public
Uni app wechat applet customer service chat function
Mongodb delete data
[hand torn STL] Stack & queue
Summary of 6 common methods of visual deep learning model architecture
SAP ui5 application development tutorial 32 - how to create a custom SAP ui5 control
Mongodb basic concept learning - Documentation
SAP ui5 Application Development Tutorial Part 30 - parameter transfer in the routing process of SAP ui5
随机推荐
Report on the application prospect and investment potential of global and Chinese cell therapy industry 2022-2028
Huawei machine test question: splicing URL
Tablespace free space
JS to realize the encapsulation of the function of obtaining the mouse click position
Tencent and China Mobile continued to buy back with large sums of money, and the leading Hong Kong stocks "led" the market to rebound?
[golang] leetcode intermediate - Search rotation sort array & search two-dimensional matrix II
C switch nested syntax
ctfshow-misc
The sum problem
Vegetables sklearn - xgboost (2)
[hand torn STL] Stack & queue
3-7sql injection website instance step 3: attack type and attack strategy
Research Report on marketing channel analysis and competitive strategy of China's polycarbonate industry 2022
Kyma application connectivity feature introduction
Interview experience - list of questions
Mongodb delete data
Mongodb basic concept learning - set
The elephant turns around and starts the whole body. Ali pushes Maoxiang not only to Jingdong
Ethernet
Leetcode sword finger offer question brushing - day 27