Hi,
I use a fine example (Example 7/12) from the book Java Network
Programming by Elliotte Rusty Harold - OReilly publication for this
InterNIC querying . Ofcource there are some deprecated methods present and
also a standalone programme - which I am sure you will able handle yourself.
This application takes 10 seconds typically to return the result . The
example is available at
ftp://ftp.ora.com/published/oreilly/java/java.netprog
The book although is published in 1997 is worth a reading .
Cheers,
Thiru
----- Original Message -----
From: "Nathan Hoover" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 17, 2000 9:29 AM
Subject: Re: Java & whios DB query
> One note that I can make here is that my code works at a much less
abstract
> level than yours does:
>
> int c;
> Socket s = new Socket("whois.networksolutions.com",43);
> InputStream in = s.getInputStream();
> OutputStream out = s.getOutputStream();
> String str = "HANDLE NH714\n"; file://could be a domain name too
> byte buf[] = str.getBytes();
> out.write(buf);
> String strRawResponse = "";
> while ((c = in.read()) != -1) {
> strRawResponse += (char)c;
> }
>
> N
>
>
> At 01:09 PM 4/16/00 -0400, Alexander Zhavoronkov wrote:
> >Hello Nathan,
> >Here is the code:
> >
> >//
>
>***************************************************************************
*
> >**************
> >// If you have fast and working code for querying whois (I don't think it
is
> >going to be conceptually
> >// different), could you please send it to [EMAIL PROTECTED] .
> >// PS> A conservative estimate is ~250 concurrent users, so I need to
make
> >it fast.
> >//
>
>***************************************************************************
*
> >**************
> >
> >import java.net.*;
> >import java.io.*;
> >import javax.servlet.*;
> >import javax.servlet.http.*;
> >
> >public class WhoisSuccess1 extends HttpServlet {
> >
> > public void init(ServletConfig config) throws ServletException {
> > super.init(config);
> > }//end init
> >
> > public void doGet (HttpServletRequest req, HttpServletResponse res)
> >throws ServletException, IOException {
> >
> > res.setContentType("text/html");
> > String dome = req.getParameter("dome");
> > String inner = dome;
> > String whoisIn = "";
> > String whoisFull = "";
> > Socket sock;
> >
> > sock = new Socket("rs.internic.net", 43); // can be "internic.net"
or
> >"whois.internic.net"
> > BufferedReader in = new BufferedReader(new
> >InputStreamReader(sock.getInputStream()));
> > PrintStream outs = new PrintStream(sock.getOutputStream());
> > outs.print(inner);
> >
> > while((whoisIn = in.readLine())!= null){
> >
> > whoisFull = whoisFull.concat(whoisIn);
> >
> > }//end while
> >
> > sock.close();
> >
> > ServletOutputStream out = res.getOutputStream();
> > out.println("<html>");
> > out.println("<head><title>Whois</title></head>");
> > out.println("<body>");
> > out.println("<h1>" + whoisFull + "</h1>");
> > out.println("</body></html>");
> > }// end doGet
> >
> >
> >}//end whoisSuccess1
> >
> >Regards,
> >Alex
> >[EMAIL PROTECTED]
> >
> >
> >Alexander Zhavoronkov
> >Queen's University
> >BComm, BSc - 2001
> >
> >
> > > 500 SECONDS! I routinely do whois queries through both JSP and
servlets
> >in
> > > about 100ms or 200ms. Let us see your code, and perhaps I can explain
what
> > > is going on here.
> > >
> > > N
> > >
> > >
> > >
> > > At 02:43 AM 4/16/00 -0400, Alexander Zhavoronkov wrote:
> > > >Hello Guys,
> > > >I have a problem:
> > > >I am using JRun with IIS and I am trying to write a java servlet,
which
> > > >woild
> > > >query thw WHOIS database for a domain name. I used a pretty standard
way:
> > > >created a socket with "internic.net", port 43 parameters, passed
> > > >a string (the requested domain name) to this socket and got a
response. I
> > > >compiled the servlet and put it in servlets JRun's folder. However,
this
> > > >qery takes
> > > >approximately 500 seconds(for one domain name)!!! 1000 slower that it
> >takes
> > > >me when I use a COM object in ASP.
> > > >Why can it be so(possible reasons)? Does anybody have any efficient
piece
> >of
> > > >code for querying whois?
> > > >Thank you.
> > > >
> > > >Alex
> > > >
> > > >PS
> > > >I'm new to Servlets and JSP - in the process of transition from ASP,
so I
> > > >may not
> > > >understand something in this case ;-)
> > > >
> > > >Alexander Zhavoronkov
> > > >Queen's University
> > > >BComm, BSc - 2001
> > > >
> > >
> >
>===========================================================================
> > > >To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > > >JSP-INTEREST".
> > > >Some relevant FAQs on JSP/Servlets can be found at:
> > > >
> > > > http://java.sun.com/products/jsp/faq.html
> > > > http://www.esperanto.org.nz/jsp/jspfaq.html
> > > > http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> > > > http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> > >
> > > Nathan Hoover
> > > R&D Manager
> > > Name Engine, Inc.
> > > http://www.registerfree.com
> > > http://www.nameengine.com
> > >
> > >
>
>===========================================================================
> > > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> >JSP-INTEREST".
> > > Some relevant FAQs on JSP/Servlets can be found at:
> > >
> > > http://java.sun.com/products/jsp/faq.html
> > > http://www.esperanto.org.nz/jsp/jspfaq.html
> > > http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> > > http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> > >
> >
>
>===========================================================================
> >To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> >JSP-INTEREST".
> >Some relevant FAQs on JSP/Servlets can be found at:
> >
> > http://java.sun.com/products/jsp/faq.html
> > http://www.esperanto.org.nz/jsp/jspfaq.html
> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
> Nathan Hoover
> R&D Manager
> Name Engine, Inc.
> http://www.registerfree.com
> http://www.nameengine.com
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets