[C#]whois script failed

Discussion in 'С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby' started by dimash, 19 Sep 2008.

Thread Status:
Not open for further replies.
  1. dimash

    dimash Elder - Старейшина

    Joined:
    14 Apr 2008
    Messages:
    78
    Likes Received:
    2
    Reputations:
    0
    ekraner.qsh.eu/whois.aspx, whois.rar
     
  2. Jes

    Jes Elder - Старейшина

    Joined:
    16 Apr 2007
    Messages:
    370
    Likes Received:
    391
    Reputations:
    34
    Код в студию , опционально с более подробным описанием проблемы
     
    4 people like this.
  3. dimash

    dimash Elder - Старейшина

    Joined:
    14 Apr 2008
    Messages:
    78
    Likes Received:
    2
    Reputations:
    0
    That whois program. -> http://www.ekraner.qsh.eu/whois.aspx. That source code. -> http://www.ekraner.qsh.eu/whois.txt. When i writen for example such domain as site.net whois back false result.
     
  4. Jes

    Jes Elder - Старейшина

    Joined:
    16 Apr 2007
    Messages:
    370
    Likes Received:
    391
    Reputations:
    34

    sry , my Eng Grammar Suxx

    oh , this example just send data to whois.ripe.net and parse response to Text Item ,

    Some knowledge of the protocol can be usefull

    http://en.wikipedia.org/wiki/WHOIS

    also try this example...

    http://209.85.135.104/search?q=cache:zFLtssWT1DwJ:www.stewshack.com/aspnet/WhoIs.aspx&hl=ru&ct=clnk&cd=4
     
  5. dimash

    dimash Elder - Старейшина

    Joined:
    14 Apr 2008
    Messages:
    78
    Likes Received:
    2
    Reputations:
    0
    Нету такого http://www.stewshack.com/aspnet/WhoIs.aspx адреса.
     
  6. procedure

    procedure Elder - Старейшина

    Joined:
    22 Dec 2007
    Messages:
    527
    Likes Received:
    257
    Reputations:
    46
    Решение:
    Code:
    TcpClient tcpc = new TcpClient();
    try
    {
      tcpc.Connect("whois.networksolutions.com", 43);
    }
    catch(SocketException ex)
    {
      Response.Write(ex.ToString());
      Response.End();
    }
    
    String strDomain = "forum.antichat.ru\r\n";
    Byte[] arrDomain = Encoding.ASCII.GetBytes(strDomain.ToCharArray());
      
    Stream s = tcpc.GetStream();
    s.Write(arrDomain, 0, strDomain.Length);
    
    StreamReader sr = new StreamReader(tcpc.GetStream(), Encoding.ASCII);
    string strLine = null;
    
    while (null != (strLine = sr.ReadLine()))
    {
       Response.Write(strLine + "<br>");
    }
    
    tcpc.Close();
    
    Сори что поднял.
     
Thread Status:
Not open for further replies.