File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with Whois port on the InterNIC Server

 
Nitin Menon
Ranch Hand
Posts: 87
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9214
9
Linux Mac OS X Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Nitin Menon
Ranch Hand
Posts: 87
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I referred a book written by Patrick Naughton.
In fact, this is an example program i found in his book.
 
Joe Ess
Bartender
Posts: 9214
9
Linux Mac OS X Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 87
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9214
9
Linux Mac OS X Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 87
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Nitin Menon
Ranch Hand
Posts: 87
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You very much.
I arrived at the got the result.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic