regrecall
regrecall

Reputation: 531

will http request timeout when server hold the connection for a long time?

when one http request send to the server(for example, java web server), and the server hold the request for a long time, don't send the response back, the timeout will happen or not?

I search for the http timeout, found the 408, and I don't think 408 is the timeout that I descirbed.

if timeout happen, can i set this timeout value? in the server or the client?

Upvotes: 0

Views: 1102

Answers (1)

user207421
user207421

Reputation: 311002

It will timeout if you've set a read timeout. If you haven't, it won't. A timeout becomes a SocketTimeoutException, not an HTTP error code. There is no HTTP error code. There is no HTTP response to get an error code from. That's why there is a timeout. You can set the timeout with URLConnection.setReadTimeout().

Upvotes: 1

Related Questions