NetHelper.cs 406 B

12345678910111213141516171819
  1. using System.Collections.Generic;
  2. using System.Net;
  3. namespace ETModel
  4. {
  5. public static class NetHelper
  6. {
  7. public static string[] GetAddressIPs()
  8. {
  9. //获取本地的IP地址
  10. List<string> addressIPs = new List<string>();
  11. foreach (IPAddress address in Dns.GetHostEntry(Dns.GetHostName()).AddressList)
  12. {
  13. addressIPs.Add(address.ToString());
  14. }
  15. return addressIPs.ToArray();
  16. }
  17. }
  18. }