c#获取本地IP地址

  string ipc = "";
            string AddressIP = string.Empty;
            foreach (IPAddress _IPAddress in Dns.GetHostEntry(Dns.GetHostName()).AddressList)
            {
                if (_IPAddress.AddressFamily.ToString() == "InterNetwork")
                {
                    AddressIP = _IPAddress.ToString();
                }
            }
            ipc = AddressIP;
            Console.WriteLine(ipc);
上一篇:Linux 复习2


下一篇:进程间通信——System V IPC与共享内存