• Post Reply Bookmark Topic Watch Topic
  • New Topic

response from upload: hangs  RSS feed

 
Robert Kennedy
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am uploading files to a server via a socket connection. I create a multipart/form-data upload, sending the required headers, file size.
The upload functions as expected however at the end of the upload I create a reader to fetch a response. This reader hangs for a minute or more
then returns the expected value. Is there something I need to send the server to tell it that I am done and I want the response.
Thanks!

BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));;
while( (strLine = br.readLine()) != null ) {
strResponse+=strLine.trim();
}
 
Joe Ess
Bartender
Posts: 9429
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you close the output stream/socket when you are done writing to it? I seem to remember that it is a requirement of the protocol.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!