2

Here is what I get: enter image description here

And here is my complete code:

import java.net.*;
import java.io.*;
class whois {
  public static void main(String args[])throws Exception {
     int c;
     Socket s=new Socket("whois.internic.net",43);
     InputStream in=s.getInputStream();
     OutputStream out=s.getOutputStream();
     String str=(args.length==0 ? "www.osborne.com" : args[0])+"\n";
     byte buf[]=str.getBytes();
     out.write(buf);
     while((c=in.read())!=-1) {
       System.out.print((char)c);
     }
     s.close();
  }
}

Now if I go to this and type there osborne.com, they will give me information about this domain. But I am getting a different output. What is the reason for this? Please explain.

Paŭlo Ebermann
  • 73,284
  • 20
  • 146
  • 210
Suhail Gupta
  • 22,386
  • 64
  • 200
  • 328
  • By the way (for next time), you can copy the text output from your command box and paste it here - it is then easier readable (and searchable, too). – Paŭlo Ebermann Mar 22 '11 at 20:33

2 Answers2

3

Change your "www.osborne.com" to "osborne.com".

osborne.com is a registered domain which you can search for in whois. www.osborne.com is a host, not a domain.

Erik
  • 88,732
  • 13
  • 198
  • 189
  • If you own a domain it's registered in whois, and you can create as many hosts you want using the domain. These hosts are *not* registered in whois - there's no need, since the base domain is. – Erik Mar 22 '11 at 18:40
  • Also note that whois isn't DNS. You need to put hosts in DNS, but whois, which keeps ownership information for domains, only cares about "which nameserver handles this domain and all its hosts/subdomains". – Erik Mar 22 '11 at 18:41
  • but all the domains are not registered in whois? – Suhail Gupta Mar 22 '11 at 18:54
  • All domains are - but different TLD's (.com, .net, .org, .eu and so on) have different whois servers. – Erik Mar 22 '11 at 18:56
1

You are typing osborne.com into the whois page, but in your code you are using www.osborne.com. Change your code to use osborne.com instead of www.osborne.com.

Greg
  • 33,450
  • 15
  • 93
  • 100