Hi All,
Can anyone help me for this issue?
For this scenario I am using a simple HttpServlet
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { InputStream is = req.getInputStream(); String line = null; BufferedReader reader = new BufferedReader(new InputStreamReader(is)); try { while ((line = reader.readLine()) != null) { System.out.println(line); } } catch (Exception e) { e.printStackTrace(); } }
public static void main(String[] args) { try { Socket s = new Socket(); s.connect(new InetSocketAddress("10.0.0.10", 8080)); s.setSoTimeout(9999999); s.setKeepAlive(true); s.setTcpNoDelay(true); PrintWriter ps = new PrintWriter(s.getOutputStream(), false); ps.println("GET http://10.0.20.10:8080/testservlet/mservlet\r\n"); ps.println("Test line 1"); ps.println("Test line 2"); ps.println("Test line 3"); ps.flush(); } catch (Exception e) { e.printStackTrace(); } }