当前位置:网站首页>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;
}

边栏推荐
- Analysis report on investment and financing status and operation benefits of global and Chinese dental industry (2022 Edition)
- The elephant turns around and starts the whole body. Ali pushes Maoxiang not only to Jingdong
- Introduction to the main features of kyma when the cloud native application runs
- Some common errors and solutions of using SAP ui5 to consume OData services
- Forecast report on output demand and supply scale of global and Chinese structural ceramics market for semiconductor equipment (2022 Edition)
- Technology inventory: Technology Evolution and Future Trend Outlook of cloud native Middleware
- Technology inventory: past, present and future of Message Oriented Middleware
- [Suanli network] problems and challenges faced by the development of Suanli network
- Click to send text messages without response is a common problem for many users in building the elegant grass Dragonfly Q system - solve the problem of clicking to send text messages without response
- Copying DNA
猜你喜欢
What changes have taken place in the project file after SAP ui5 tools ran the Fiori add deploy config command

Hands on deep learning (III)

Day21 performance test process
MySQL transaction learning notes (I) first encounter

MySQL uses the where condition to find strange results: solve
DOM proficient? What is the difference between node and elment?

What is the use of the subprocess module
Technology inventory: past, present and future of Message Oriented Middleware

Uni app wechat applet customer service chat function

Click to send text messages without response is a common problem for many users in building the elegant grass Dragonfly Q system - solve the problem of clicking to send text messages without response
随机推荐
Vscode voice notes to enrich information (medium)
DF command – displays disk space usage
Tablespace free space
Rhcsa day 4
DOM proficient? What is the difference between node and elment?
Getting started with Silverlight development 1
Analysis report on production and sales demand and sales prospect of global and Chinese phosphating solution Market 2022-2028
Cnpm installation
Introduction to MySQL test run test framework
The locally developed SAP ui5 application is deployed to the ABAP server to perform error analysis
Processes and threads - concepts and process scheduling
[Suanli network] technological innovation of Suanli Network -- Key Technologies of green and security
PAT (Advanced Level) Practice 1025
How to open an account online? Is it safe to open an account online?
CST8227
What are the reasons why most webmasters choose Hong Kong site group servers?
The e-book "action guide for large organizations to further promote zero code application platform" was officially released!
Investment opportunities and operational risk assessment report of China's engineering consulting industry during the 14th Five Year Plan period 2022-2028
The elephant turns around and starts the whole body. Ali pushes Maoxiang not only to Jingdong
Introduction to the main features of kyma when the cloud native application runs