Today was a very productive day. I was able to finish my WiFi implementation and test it thoroughly. And I made some amazing discoveries.
First of all, a while ago we ran some tests on the iPhone, iPod and G1 devices to determine the latency and throughput of the WiFi connection. The results were sobering. GameKit appeared to be the rescue, delivering about the same throughput (about 60KiB/s) and better latency (15-30ms). The drawback was that it only supported 3 devices, making it completely unusable for our purposes.
Now, with my new WiFi implementation, I’ve ran similar tests to those before, and I’m now getting an awesome 600KiB/s throughput over one or several TCP connections. Because it’s using my wrapper interface, we can easily switch to gamekit to perform some comparisons. We’re still getting at most 60KiB/s with the very same code when switching to the GameKit implementation (switching is just one line of code). So we’re seeing an almost tenfold increase of throughput here, and we’re absolutely amazed.
But what about the latency? As it turned out yesterday, the latency can be good with WiFi, too. You just have to be sending data constantly. We’re getting about 15-45ms, with a little more variance than the Bluetooth connection. But the difference is, we can even sustain this latency while pushing reliable data out at 500Kib/s and more. There may be a little more packet drop and variance in the latencies, but it’s still essentially very responsive.
We’ve also performed some tests with the total number of clients, and so far we had 4 iP* devices (2x Touch 2G, 1x iPhone 3G, 1x iPhone 3GS) and two MacBook Pros (in the simulator), in the same room via one (dedicated) WiFi router. So it was a total of 6 clients, and it was great. Low latencies, no reliability issues, high throughput (about 120KiB/s per client output, iPhone 3GS was the host). I’m curious to find out how this scales with more devices (at some point there must be WiFi interference, I guess).
I’m going to hang out and make pizza with some friends now, but I’m going to post more stuff tomorrow. There are some problems I ran into (SIGPIPEs, address reuses, weird UDP errors) that I want to write down.
BTW, thanks for the comments, it’s great to see people’s interest in this stuff, and motivates me to post more 🙂 Also, check out my good friends Sander’s blog, he got some great megatexturing results.