SEO: A whois server that work for .SE domains?

Posted by Niels Bosma on Stack Overflow See other posts from Stack Overflow or by Niels Bosma
Published on 2010-12-12T18:48:34Z Indexed on 2011/01/08 10:54 UTC
Read the original article Hit count: 375

Filed under:
|

I'm developing a small domain checker and I can't get .SE to work:

    public string Lookup(string domain, RecordType recordType, SeoToolsSettings.Tld tld)
    {
        TcpClient tcp = new TcpClient();
        tcp.Connect(tld.WhoIsServer, 43);
        string strDomain = recordType.ToString() + " " + domain + "\r\n";
        byte[] bytDomain = Encoding.ASCII.GetBytes(strDomain.ToCharArray());
        Stream s = tcp.GetStream();
        s.Write(bytDomain, 0, strDomain.Length);
        StreamReader sr = new StreamReader(tcp.GetStream(), Encoding.ASCII);
        string strLine = "";
        StringBuilder builder = new StringBuilder();
        while (null != (strLine = sr.ReadLine()))
        {
            builder.AppendLine(strLine);
        }
        tcp.Close();
        if (tld.WhoIsDelayMs > 0) System.Threading.Thread.Sleep(tld.WhoIsDelayMs);
        return builder.ToString();
    }

I've tried whois servers whois.nic-se.se and whois.iis.se put I keep getting:

# Copyright (c) 1997- .SE (The Internet Infrastructure Foundation).
# All rights reserved.

# The information obtained through searches, or otherwise, is protected
# by the Swedish Copyright Act (1960:729) and international conventions.
# It is also subject to database protection according to the Swedish
# Copyright Act.

# Any use of this material to target advertising or
# similar activities is forbidden and will be prosecuted.
# If any of the information below is transferred to a third
# party, it must be done in its entirety. This server must
# not be used as a backend for a search engine.

# Result of search for registered domain names under
# the .SE top level domain.

# The data is in the UTF-8 character set and the result is
# printed with eight bits.

"domain google.se" not found.

Edit:

I've tried changing to UTF8 with no other result.

When I try using whois from sysinternals I get the correct result, but not with my code, not even using SE.whois-servers.net.

/Niels

© Stack Overflow or respective owner

Related posts about c#

Related posts about whois