In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail how to write asp in C# software. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
Source code:
Void doQuery (Object sender, EventArgs e)
{
String strDomain = txtDomain.Text
Char [] chSplit = {'.'}
String [] arrDomain = strDomain.Split (chSplit)
Int nLength = arrDomain [1] .length
Hashtable table = new Hashtable ()
Table.Add ("de", "whois.denic.de")
Table.Add ("be", "whois.dns.be")
Table.Add ("gov", "whois.nic.gov")
Table.Add ("mil", "whois.nic.mil")
String strServer; / / define whois server
/ / if the domainname's end is cn then the server is cnnic
Otherwise is networksolutions
If (arrDomain [arrDomain.Length-1] = = "cn")
{
StrServer = "159.226.6.139"
}
Else
{
StrServer = "whois.networksolutions.com"
}
If (table.ContainsKey (arrDomain [1]))
{
StrServer = table [arrDomain] [1]] .ToString ()
}
Else if (nLength = = 2)
{
/ / 2-letter TLD's always default to RIPE in Europe
StrServer = "whois.ripe.net"
}
String strResponse
Bool bSuccess = DoWhoisLookup (strDomain, strServer, out strResponse)
If (bSuccess)
{
TxtResult.Text = strResponse
}
Else
{
TxtResult.Text = "Lookup failed"
}
}
Bool DoWhoisLookup (String strDomain, String strServer, out String strResponse)
{
StrResponse = "none"
Bool bSuccess = false
TCPClient tcpc = new TCPClient ()
If (0 = tcpc.Connect (strServer, 43))
{
StrDomain + = "\ r\ n"
Byte [] arrDomain = Encoding.ASCII.GetBytes (strDomain.ToCharArray ())
Try
{
Stream s = tcpc.GetStream ()
S.Write (arrDomain, 0, strDomain.Length)
StreamReader sr = new StreamReader (tcpc.GetStream (), Encoding.ASCII)
StringBuilder strBuilder = new StringBuilder ()
While (- 1! = sr.Peek ())
{
StrBuilder.Append (sr.ReadLine () + "")
}
Tcpc.Close ()
BSuccess = true
StrResponse = strBuilder.ToString ()
}
Catch (Exception e)
{
StrResponse = e.ToString ()
}
Return bSuccess
}
Else
{
StrResponse = "Could not connect to Whois server"
Return false
}
Return false
}
Domain name: WWW.
This is the end of the article on "how to write asp in C# Software". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.