Hi, I'm send a string to a servlet. After a while (usually the third time) the servlet don't receive the data I send and the application waits for datas from servlet. My application server is Allaire JRUN 3.0 Here is my code. What is wrong ? ------SERVLET------- public void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException{ try{
log.add("Serv OK"); } catch(Exception e) { log.add(e.getMessage()); } } -------application------- private void App_click(Object source, Event e) { try{ log.add("New click"); log.add("setup and connection"); URL url = new URL("http://mqu/biblio/servlet/Servlet"); URLConnection connection = url.openConnection(); connection.setDoOutput(true); connection.setDoInput(true); connection.setUseCaches(false); log.add("send data to servlet"); PrintStream out = new PrintStream(connection.getOutputStream()); out.println("string"); out.flush(); out.close(); log.add("Receive from servlet"); BufferedReader in = new BufferedReader( new InputStreamReader( connection.getInputStream()));
String inputLine;
log.add("Extracting data"); StringBuffer msgBuf = new StringBuffer(); while ((inputLine=in.readLine())!=null) { if (msgBuf.length()>0) msgBuf.append('\n'); msgBuf.append(inputLine); }