18.117.105.164
Y o u r I P i s
18.117.105.164
[ 현재: ] : Timestamp Converter
C# Real IP Check Function
public static IPAddress GetExternalIp()
{
string ip = string.Empty;
try
{
string sourceURL = string.Empty;
sourceURL = string.Format("https://api.tion.kr");
WebClient client = new WebClient();
client.Encoding = Encoding.UTF8;
string data = client.DownloadString(string.Format("https://api.tion.kr"));
string pattern = "()(?[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}?)()";
MatchCollection matches = Regex.Matches(data, pattern);
foreach (Match match in matches)
{
if (match.Groups["ip"].Length > 0)
{
//IP 정상적으로 나오는지 확인하는부분
//MessageBox.Show(match.Groups["ip"].Value);
ip = match.Groups["ip"].Value;
}
}
}
catch (Exception)
{
}
IPAddress externalIp = IPAddress.Parse(ip);
return externalIp;
}