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

边栏推荐
- SAP ui5 beginner tutorial No. 27 - unit test tool quNit introduction trial version for SAP ui5 application
- Distributed solar photovoltaic inverter monitoring
- What happens when redis runs out of memory
- Linus' speech recordings, which were lost in 1994, were made public
- How SAP ui5 device type detection device API works
- Analysis report on investment and financing status and operation benefits of global and Chinese dental industry (2022 Edition)
- 50 days countdown! Are you ready for the Landbridge cup provincial tournament?
- Technology Review: Interpretation of cloud native architecture trend in 2022
- MySQL uses the where condition to find strange results: solve
- HashSet implementation class
猜你喜欢
Introduction to sap ui5 tools
[interview with a large factory] meituan had two meetings. Was there a surprise in the end?

Soft exam information system project manager_ Management Science (Operations Research) 2--- senior information system project manager of soft test 034

Pre knowledge of asynchronous operation

Gavin's insight on transformer live class - line by line analysis and field experiment analysis of insurance BOT microservice code of insurance industry in the actual combat of Rasa dialogue robot pro

Es11 new methods: dynamic import(), bigint, globalthis, optional chain, and null value merging operator
Yunda's cloud based business in Taiwan construction 𞓜 practical school

Socket, network model notes
Linus' speech recordings, which were lost in 1994, were made public

Create a complete binary tree in array order
随机推荐
Vscode voice notes to enrich information (Part 1)
The elephant turns around and starts the whole body. Ali pushes Maoxiang not only to Jingdong
HashSet implementation class
Differences and connections between sap ui5 and openui5
[kicad image] download and installation
Interview experience - list of questions
Go quiz: considerations for function naming return value from the go interview question (more than 80% of people answered wrong)
Folding mobile phones are expected to explode, or help Samsung compete with apple and Chinese mobile phones
SAP ui5 application development tutorial 32 - how to create a custom SAP ui5 control
Pat 1045 quick sort
How to open an account online? Is it safe to open an account online?
Gavin's insight on transformer live class - line by line analysis and field experiment analysis of insurance BOT microservice code of insurance industry in the actual combat of Rasa dialogue robot pro
Rhcsa day 4
What happens when redis runs out of memory
ctfshow-misc
What is hybrid web containers for SAP ui5
Soft exam information system project manager_ Management Science (Operations Research) 2--- senior information system project manager of soft test 034
Three tier architecture experiment
An easy problem
Analysis report on production and sales demand and sales prospect of global and Chinese phosphating solution Market 2022-2028