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

Reply via email to