I am wondering when I read a response stream and a timeout occurs, can I retry the read? Or do I have to make a new request? The server that I am downloading from does not support resuming, so I need to protect against timeouts.
A:
How do you know that the server doesn't accept resumes? Is the Accept-Ranges
header indeed lacking in the response? If not, you could resume the request using the Range
header.
If the server indeed doesn't support it, then best what you can try is to inform the server that you want to keep the connection alive using Connection: keep-alive
header in combination with the Keep-Alive
header wherein you can specify the timeout.
Hope this helps.
BalusC
2009-11-07 19:34:56