• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with Whois port on the InterNIC Server

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank You very much.
I arrived at the got the result.
 
All of the following truths are shameless lies. But what about this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic