I use
URLConnection urlConn = theURL.openConnection();
// set connect timeout.
urlConn.setConnectTimeout(5000);
// set read timeout.
urlConn.setReadTimeout(5000);
in my application. One timeout for the connection time, on for the time until the read starts. Is there any simple way to timeout the actual data transfer process?
I have threads reading data from either very slow hosts, or the data source is very big, what leads to too long transfer times. How can I limit that time?