Hello,
I am writing a file to a socket and then trying to read a response.
There is a
jsp which receives the call and processes the data. In my jsp I can see that the request is handled correctly and the response line is reached in less than 1 second.
However on the client (
Applet) I wait in a loop for almost a minute and then receive a socket closed message.
I never see my output from the jsp.
out.println("bytes/elapsed: " + String.valueOf(lgBytesTransferred) + " : " + (System.currentTimeMillis() - lgstart));
I only receive:
communicator. read response: HTTP/1.1 200 OK
communicator. read response: Date: Tue, 29 Jul 2008 19:59:58 GMT
communicator. read response: Server: Apache/2.0.58 (Unix) mod_ssl/2.0.58 OpenSSL/0.9.8a PHP/5.1.4
communicator. read response: Content-Length: 0
communicator. read response: Connection: close
communicator. read response: Content-Type: text/plain; charset=ISO-8859-1
communicator. read response:
=============================================
// write the file bytes to the socket
int bytesRead=-1;
while ( ((bytesRead = fis.read(buffer)) != -1) )
write(buffer, 0, bytesRead);
// wait for a response
BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
while( (strInputLine = br.readLine()) != null )
System.out.println("response: " + strInputLine.trim());