Hi, everyone,
 
I wrote a little servlet which get data from the browser and forward it to a proxy server and then get response records from the server to display them in the browser.
 
I want to display the records right away when the servlet get them from server, so I use function flush(), but it seems have no effect, because all records will be displayed together after all is gotten.
 
Here is a snip of the servlet. I don't know how to achieve my thoughts, any reply would be welcome.
 
Jianhong
 
 
 protected void doPost(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
 {
  try {
    ...
    // read data from proxy server
   for (int i=0; i<nCount; i++) {
    int nLength = din.readInt();
    if (nLength > 0) {
     byte bytes[] = new byte[nLength];
     din.readFully(bytes);
     out.println(new String(bytes));
     out.flush();
    }
   }
    ...

Reply via email to