26 Ekim 2013 Cumartesi

C# Dış IP (İnternet)

Dış "İnternet" IP bulmak için yardımcı kod.

System.Net.WebClient webClient = new System.Net.WebClient();
string dnsString = webClient.DownloadString("http://checkip.dyndns.org");
dnsString = (new System.Text.RegularExpressions.Regex(@"\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b")).Match(dnsString).Value;
webClient.Dispose();

MessageBox.Show(stringDns);

Hiç yorum yok: