Local IP address
-
C# Local host 가져오기 (로컬 IP 주소 확인하기)닷넷/C# 2017. 8. 24. 17:54
using System.Net; using System.Net.Sockets; private string GetLocalIP() { string myIP = ""; IPHostEntry host = Dns.GetHostEntry(Dns.GetHostName()); foreach (IPAddress ip in host.AddressList) { if (ip.AddressFamily == AddressFamily.InterNetwork) { myIP = ip.ToString(); } } return myIP; }