D
Donar
Good morning Ladies and Gents,
I am trying to develop a WebService and could use some pro's help with
an issue I ran into.
Among other things, the WebService involves querying a Whois server at
well-known port 43. When attempting to access the TCP client's data
with a StreamReader, the code hangs. No exception is thrown, it just
times out.
What am I doing wrong here? Is it possible that the WebService does
not allow such a connection?
Greatly appreciating your answer.
Regards.
This is the code snippet in question:
//Get the Internet address of the Whois server for this
Registry.
//With it, we can create a TcpClient (to well-known Whois
port 43)
string sWhoisAddr = "whois.arin.net";
TcpClient oTCPClt = new TcpClient(sWhoisAddr, 43);
//Querying the registry for the Whois record about an IP
in sIP.
//For example we have in sIP = "62.202.32.88"
byte[] abIP = Encoding.ASCII.GetBytes(sIP);
Stream oCltStream = oTCPClt.GetStream();
oCltStream.Write(abIP, 0, sIP.Length);
//Store the Whois server's response
StreamReader oPage =
new StreamReader(oTCPClt.GetStream(), Encoding.ASCII);
//THIS TIMES OUT, NO DATA IS RECEIVED. WHY?
//string sPage = oPage.ReadToEnd(); //Read the
answer
I am trying to develop a WebService and could use some pro's help with
an issue I ran into.
Among other things, the WebService involves querying a Whois server at
well-known port 43. When attempting to access the TCP client's data
with a StreamReader, the code hangs. No exception is thrown, it just
times out.
What am I doing wrong here? Is it possible that the WebService does
not allow such a connection?
Greatly appreciating your answer.
Regards.
This is the code snippet in question:
//Get the Internet address of the Whois server for this
Registry.
//With it, we can create a TcpClient (to well-known Whois
port 43)
string sWhoisAddr = "whois.arin.net";
TcpClient oTCPClt = new TcpClient(sWhoisAddr, 43);
//Querying the registry for the Whois record about an IP
in sIP.
//For example we have in sIP = "62.202.32.88"
byte[] abIP = Encoding.ASCII.GetBytes(sIP);
Stream oCltStream = oTCPClt.GetStream();
oCltStream.Write(abIP, 0, sIP.Length);
//Store the Whois server's response
StreamReader oPage =
new StreamReader(oTCPClt.GetStream(), Encoding.ASCII);
//THIS TIMES OUT, NO DATA IS RECEIVED. WHY?
//string sPage = oPage.ReadToEnd(); //Read the
answer