08 December 2016

Domain Whois

Kodları Formun Load eventine yazalım. Whois bilgilerini richtextbox’da gösterebiliriz.

private void Form1_Load(object sender, EventArgs e)
 {
 string txtResponse = String.Empty;
 string strResponse = String.Empty;
TcpClient tcpWhois = new TcpClient("whois.internic.net", 43);
 NetworkStream nsWhois = tcpWhois.GetStream();
 BufferedStream bfWhois = new BufferedStream(nsWhois);
StreamWriter swSend = new StreamWriter(bfWhois);
 swSend.WriteLine("yazilimciblog.com");
 swSend.Flush();
StreamReader srReceive = new StreamReader(bfWhois);
while ((strResponse = srReceive.ReadLine()) != null)
 {
 txtResponse += strResponse + "\r\n";
 }
tcpWhois.Close();
 richTextBox1.Text = txtResponse;
}