기타 ETC/C#

C# 에서 IP 주소 가져오는 방법

엘제이떠블유 2020. 3. 27. 15:00
private string GetIP() {     
string strHostName = "";     
strHostName = System.Net.Dns.GetHostName();    
IPHostEntry ipEntry = System.Net.Dns.GetHostEntry(strHostName);    
IPAddress[] addr = ipEntry.AddressList;     
return addr[addr.Length - 1].ToString(); 
}

C# 에서 IP 주소 가져오는 방법