Mit der Whois Abfrage kann der Eigentümer einer Internetadresse von einem Whois Server abgefragt werden.
Hier gibt es ein Liste aktueller WHOIS Server: http://de.wikipedia.org/wiki/Whois
benötigte Usings:
using System.IO;
using System.Net.Sockets;
using System.Text;
/// <summary>
/// Gets the whois information.
/// </summary>
/// <param name="whoisServer">The whois server.</param>
/// <param name="url">The URL.</param>
/// <returns></returns>
private string GetWhoisInformation(string whoisServer, string url)
{
StringBuilder stringBuilderResult = new StringBuilder();
TcpClient tcpClinetWhois = new TcpClient(whoisServer, 43);
NetworkStream networkStreamWhois = tcpClinetWhois.GetStream();
BufferedStream bufferedStreamWhois = new BufferedStream(networkStreamWhois);
StreamWriter streamWriter = new StreamWriter(bufferedStreamWhois);
streamWriter.WriteLine(url);
streamWriter.Flush();
StreamReader streamReaderReceive = new StreamReader(bufferedStreamWhois);
while (!streamReaderReceive.EndOfStream)
stringBuilderResult.AppendLine(streamReaderReceive.ReadLine());
return stringBuilderResult.ToString();
}
1 Kommentare zum Snippet