I am trying to query WHOIS server through code but I am getting exception :
No connection could be made because the target machine actively refused it
If I look at the details of SocketException
then I see ErrorCode = 10061
, which is for:
No connection could be made because the target computer actively refused it. This usually results from trying to connect to a service that is inactive on the foreign host—that is, one with no server application running.
My Code is:
using (TcpClient tcpClinetWhois = new TcpClient("whois.internic.net", 43))
I have also tried "whois.cira.ca"
, but both of them are returning the same error.
I have searched for the error, disabled my firewall, also tried opening port 43 for TCP connections on my computer but nothing seemed to have resolved it. Any idea why this would happen ?
I am actually trying to get Primary and Secondary domain names for a url.