File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Sockets and Internet Protocols and the fly likes Problem with Whois port on the InterNIC Server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Problem with Whois port on the InterNIC Server" Watch "Problem with Whois port on the InterNIC Server" New topic
Author

Problem with Whois port on the InterNIC Server

Nitin Menon
Ranch Hand

Joined: Jun 13, 2007
Posts: 79
I have written a simple program that opens a connection to a whois port on the InterNIC server, sends the command line argument down the socket, and then prints the data that is returned. But i am getting a ConnectException saying connection timed out.

Below is the program


JCE: added code tags
[ October 22, 2008: Message edited by: Joe Ess ]
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8836
    
    7

I tried using telnet to connect to port 43 at internic.net and got a connection timeout. Where did you hear you can use that tld/port?


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Nitin Menon
Ranch Hand

Joined: Jun 13, 2007
Posts: 79
I referred a book written by Patrick Naughton.
In fact, this is an example program i found in his book.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8836
    
    7

What is the book title and version?
Does it reference a web site we can see the errata on? The code should work, it's just that there doesn't seem to be any service listening on port 43. We can easily get your code to connect to port 80, which we know works because we can access the web site:

[ October 22, 2008: Message edited by: Joe Ess ]
Nitin Menon
Ranch Hand

Joined: Jun 13, 2007
Posts: 79
Thank you very much..!
The code is working fine.
I should've guessed it. I believe that port 80 is for HTTP. right?
I found the program from the book
"The Complete Reference - Java 2 [5th Edition]" By Patrick Naughton and Herbert Schildt.
No. It does not refer any site where we can see the error data.

Once Again,
Thank you for your help and suggestions.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8836
    
    7

Originally posted by Nitin Menon:
I should've guessed it. I believe that port 80 is for HTTP. right?


Right. Note that I had to make a couple of changes to get the code to work with HTTP as opposed to the nameless protocol the original code used: The two carriage return and new lines at the end of str and the flush.
Using a different protocol, FTP for example, would require changes as well.
Nitin Menon
Ranch Hand

Joined: Jun 13, 2007
Posts: 79
yes. I noted the changes to the code.
I can see that it is in a more readable form.
Thank you.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

The reason that the original code is broken is that "internic.net" is not the correct host. Internic provides whois services at "whois.internic.net". Port 43 is correct.


[Jess in Action][AskingGoodQuestions]
Nitin Menon
Ranch Hand

Joined: Jun 13, 2007
Posts: 79
Thank You very much.
I arrived at the got the result.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Problem with Whois port on the InterNIC Server
 
Similar Threads
File Transfer via Sockets
IO problem
problem with socket connecting??
Problem Using Sockets and BufferedReader
Please Help Me WIth Whois Server