iPhone上3G的典型UDP延迟 - 我的号码是对的吗? [英] Typical UDP latency on iPhone over 3G - are my numbers right?

查看:138
本文介绍了iPhone上3G的典型UDP延迟 - 我的号码是对的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了评估iPhone上的TCP与UDP,我在我的计算机上编写了一个小型echo服务器并在iPhone上使用了AsyncUdpSocket库,但延迟时间非常大,我想知道我的实现是否有问题不知何故。

In order to evaluate TCP versus UDP on the iPhone, I wrote a small echo server on my computer and used the AsyncUdpSocket library on the iPhone, but latencies are coming out surprisingly large and I wonder if there is something wrong with my implementation somehow.

我的设置有一个wifi路由器(Apple Airport),它有一个外部静态IP。 echo服务器使用的端口被转发到我的开发计算机。

My setup has a wifi-router (Apple Airport) which has an external static IP. The port used by the echo server is forwarded to my development computer.

我使用了两种不同的设置:

I used two different setups:


  1. iPhone - > Wifi - > Wifi路由器 - > Wifi - >电脑

  2. iPhone - > 3G - > Wifi路由器 - > Wifi - >电脑

数据包大小约为10个字节。

Packet size was around 10 bytes.

在第一种情况下,往返从9变化毫秒到600毫秒。大多数情况下,我会看到大约300毫秒的中位数,但有些运行只有30毫秒。

In the first case, roundtrip varied from 9 ms to 600 ms. Mostly I would see a median of around 300 ms, but some runs would have only 30 ms.

第二种情况......最佳情况2000毫秒,移动到5000毫秒。

Second case... Best case 2000 ms, moving up to 5000 ms.

实施将发送一个UDP数据包,等到它回来,然后发送下一个。

Implementation would send an UDP packet, wait until it gets back, then send the next.

I最初认为实施有些问题,但是从模拟器运行它只能提供7毫秒的一致延迟。

I initially believed something was wrong with the implementation, but running it from the simulator give a consistent latency of only 7 ms.

我的数字是正确的还是奇怪的事情?

Are my numbers right or is something weird going on?

推荐答案

我看到了这个关于iphone Wifi延迟的链接我决定尝试更快地提取UDP数据包。

I saw this link on iphone Wifi latency and I decided to try pumping UDP packets faster.

我开始降低接收ping和发送新ping之间的延迟,直到我达到50 ms。

I started lowering my delay between receiving a ping and sending a new ping until I reached 50 ms.

在50 ms时,UDP ping(往返)关闭使用3G到大约80毫秒(记住,这最初是在2000毫秒左右)!

At 50 ms, the UDP ping (roundtrip) was down to around 80 ms using 3G (remember, this was originally around 2000 ms)!

TCP也有所改进,但没有UDP那么多。我将获得100-200毫秒,再次使用3G。

TCP also improved, but not as much as UDP. I would get 100-200 ms, again on 3G.

我的结论是iPhone关闭天线,严重影响UDP。 TCP更好,因为手机知道开放连接并且启动速度更快。

My conclusion is that iPhone powers down the antennae, which severely affects UDP. TCP is better, because the phone knows of the open connection and is faster to power up.

顺便在数据包丢失期间,TCP将达到ping 1000-2000毫秒这与自己的观察一致,即TCP连接偶尔会在iPhone上遭受大量延迟。

Incidentally during packet loss, TCP would reach pings of 1000-2000 ms. This coincides with own observations that TCP connections would occasionally suffer large delays on the iPhone.

这篇关于iPhone上3G的典型UDP延迟 - 我的号码是对的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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