Skip to content Skip to sidebar Skip to footer

Download Files From Different Domains With One Connection

Well this question may sounds a little crazy but I just want to save time and engergy. To open a connection needs time and engergy on a mobile device so I want to reuse open connec

Solution 1:

The solution is quiet simple (if you found it):

HttpGet get2 = new HttpGet("http://example.com/robots.txt");
BasicHttpParams params = new BasicHttpParams();
params.setParameter(ClientPNames.VIRTUAL_HOST, new HttpHost("example.net", -1, "http"));
get2.setParams(params);

So will the connection be reused because it's the same domain/port/schema and the DefaultHttpClient will look for that parameter ClientPNames.VIRTUAL_HOST.

I found the solution with the sourcecode which is actuall used by android which is to find on code.google.com.

Post a Comment for "Download Files From Different Domains With One Connection"