I'm trying to write an advanced whois client, so I experimented with sending commands to whois servers using netcat (nc) on Arch Linux. For example, this works great:
$ echo domain google.com | nc whois.crsnic.net 43
However, a whois server that processes suffixes such as .br.com , whois.centralnic.net , and this server does not seem to work with netcat. When I give him any request, it just closes the connection without an answer:
$ echo foobar | nc whois.centralnic.net 43
I successfully executed the same request using telnet:
$ telnet whois.centralnic.net 43 Trying 193.105.170.136... Connected to whois.centralnic.net. Escape character is '^]'. foobar DOMAIN NOT FOUND Connection closed by foreign host.
So, what can make a server behave differently for telnet than netcat?
I thought this was a time problem, so I tried unsuccessfully:
$ { sleep 4; echo foobar; sleep 4; } | nc whois.centralnic.net 43
I saw that netcat has the -T option to make it behave like telnet, so I tried unsuccessfully:
$ { sleep 4; echo foobar; sleep 4; } | nc -T whois.centralnic.net 43
On my production system, I will not use netcat or telnet, but there seems to be some strange network problem here, and I would like to know about that. Can anyone shed some light on why netcat will work on all whois servers, but only telnet will work on whois.centralnic.net?