是否支持Android多个HTTP请求在同一时间? [英] Does Android support multiple HTTP requests at the same time?

查看:435
本文介绍了是否支持Android多个HTTP请求在同一时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序,我想处理多个文件下载在同一时间。 要做到这一点,我在开始的几个服务,为每个请求。 由于我不知道,不支持Android并发的HTTP请求的并行?

In my app I'd like to handle downloading of several files at the same time. To do so I'm starting several services, one for each request. As I'm not sure, does Android support simultaneous http requests in parallel?

在这种情况下,它是好还是坏习惯有一个了HTTPClient每个请求的?

In that case, is it good or bad habit to have one HTTPClient per request?

非常感谢您的帮助!

推荐答案

HttpClient的不同步,不支持并行连接本身。你可以有多个线程每个执行下载独立HttpClient的实例。

HttpClient is not asynchronous and does not support parallel connections per se. You could have multiple threads each performing download with separate HttpClient instances.

您可能也想看看的ExecutorService:<一href="http://developer.android.com/reference/java/util/concurrent/ExecutorService.html">http://developer.android.com/reference/java/util/concurrent/ExecutorService.html

You might also want to look at ExecutorService: http://developer.android.com/reference/java/util/concurrent/ExecutorService.html

这篇关于是否支持Android多个HTTP请求在同一时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆