title: I am trying to get location information from ip address in JAVA but I am getting a java.net.SocketException: Connection reset error
body: <pre><code>import java.io.IOException;
  import java.io.PrintWriter;
  
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  
  import javaQuery.importClass.javaQueryBundle;
  import javaQuery.j2ee.GeoLocation;
  /**
   * Servlet implementation class IP
   */
  public class IP extends HttpServlet {
      private static final long serialVersionUID = 1L;
  
      /**
       * @see HttpServlet#HttpServlet()
       */
      public IP() {
          super();
          // TODO Auto-generated constructor stub
      }
  
      /**
       * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
       */
      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          // TODO Auto-generated method stub
  
           String ipAddress = request.getRemoteAddr();
           System.out.println(ipAddress);
  
           response.setContentType("text/html;charset=UTF-8");
              PrintWriter out = response.getWriter();
  
  
              //Print out the IP address of the caller
              out.println(request.getRemoteAddr());
  
  
           GeoLocation $gl = javaQueryBundle.createGeoLocation();
  
           System.out.println(ipAddress);
  
  
              $gl.MAPTargetByIP(ipAddress, "test");
              System.out.println($gl.Latitude);
              System.out.println($gl.Longitude);
              System.out.println($gl.Country);
              System.out.println($gl.City);
              System.out.println($gl.State);
              System.out.println($gl.GoogleMap_URL);
              System.out.println($gl.GoogleMap_URL_Bubble);
  
  
      }
  
      /**
       * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
       */
      protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          // TODO Auto-generated method stub
      }
  
  }
  </code></pre>
  
  <p>This is my code snippest.I am getting IP address of visitor but not location information.
      It gives :
      java.net.SocketException: Connection reset
          at java.net.SocketInputStream.read(Unknown Source)
          at java.net.SocketInputStream.read(Unknown Source)</p>