프로그래밍/.NET
[C#]IP 주소 얻기
건깡
2013. 5. 14. 10:19
public string CLIENTIP { get { System.Net.IPHostEntry host = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()); string clientIP = string.Empty; for (int i = 0; i < host.AddressList.Length; i++) { // AddressFamily.InterNetworkV6 - IPv6 if (host.AddressList[i].AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) { clientIP = host.AddressList[i].ToString(); } } return clientIP; } }