是套接字连接不是http上黑莓更快? [英] Are socket connections faster than http on Blackberry?
问题描述
我在写最初在标准的J2ME实施了黑莓的应用程序。网络连接是用做 Connector.open(插座:// ...:80 / ...)
而不是 HTTP:/ /
I'm writing an app for Blackberry that was originally implemented in standard J2ME. The network connection was done using Connector.open("socket://...:80/...")
instead of http://
现在,我实现了使用这两种方法的连接,而且好像有些时候,插座的方法是更加敏感,有的时候也不能在所有工作。有两者之间的显著差异?大多是我想要实现的是从连接顺利拿到了进度条的响应。
Now, I've implemented the connection using both methods, and it seems like some times, the socket method is more responsive, and some times it doesn't work at all. Is there a significant difference between the two? Mostly what I'm trying to achieve is responsiveness from the connection to get a smooth progress bar.
推荐答案
黑莓的实施 HTTP
和 HTTPS
提供用于连接到目标服务器比插座
,当然还有更多的选择,实现所有的HTTP协议的东西给你。我没有他们的基准,但它使一定量的意义上说,直接 TCP
通过插座
将是更快某些情况下,特别是如果什么端口80听的不是的HTTP服务器(无协议开销)
Blackberry's implementation of http
and https
provide more options for connecting to the target server than socket
, and, of course, implement all the HTTP protocol stuff for you. I've not benchmarked them, but it makes a certain amount of sense that direct TCP
via socket
would be quicker in some cases, especially if what is listening on port 80 isn't an HTTP server (no protocol overhead)
我已经很难在不同的网络供应商在过去,有些需要 deviceside = TRUE
其他 deviceside = FALSE
,并没有真正的办法知道,直到第一个支持电话为网络进来了。
I've had difficulty in the past with different network providers, some requiring deviceside=true
others deviceside=false
, and no real way to know until the first support call for that network came in.
天色我想要实现的是从连接顺利拿到了进度条的响应。
Mostly what I'm trying to achieve is responsiveness from the connection to get a smooth progress bar.
原谅我这么说,但进展顺利栏是锦上添花 - 不错的,看看,但应用程序的功能,可靠性或耐用性并不重要。 。可能的 HTTP
在这种情况下
Pardon my saying so, but a "smooth progress bar" is "gilding the lily" - nice to have and look at, but not critical to the application's function, reliability or robustness. Go with what is more robust and reduces code size - likely http
in this case.
这篇关于是套接字连接不是http上黑莓更快?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!