开发者

Unexpected Output_networking

Here is what I get:

Unexpected Output_networking

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.开发者_StackOverflow中文版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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜