Horrible problem -- device specific!

94 views
Skip to first unread message

JP May

unread,
May 6, 2011, 6:26:39 PM5/6/11
to cocoaasy...@googlegroups.com
Hello, CocoaAsyncSocket list !

CocoaAsyncSocket is about my favourite library, but we've found a horrible problem -- either in AsyncSocket, or, perhaps the underlying.


The problem is described at length here:

http://stackoverflow.com/questions/5917426/horrible-ipodtouch4-specific-networking-problem-demo-app-video

You can play a video here .. http://www.mediafire.com/?rie4xpeeptgemvo

or download a full demo here:

http://www.mediafire.com/?a1cnkodxd5mna6c


in short, performance is hideous with an iPodTouch4 as a client .. nothing else!

You can use either iPad, or any gen phone, etc, as a client, and it works flawlessly.


How could this be?

If you have an iPodTouch4, check it out.


Thanks for any ideas,
Fat Johnnie

Robbie Hanson

unread,
May 6, 2011, 11:38:01 PM5/6/11
to cocoaasy...@googlegroups.com
Good question.  I'm trying to get my hands on an iPodTouch 4...

Out of curiosity, if you disable nagle's algorithm on the server side, do you still see the issue when using iPodTouch4 as the client?
Here's how you can disable nagle:

Turning ON TCP_NODELAY (setting to 1) will disable nagle's algorithm.
Remember, do this on the server side.  (You could also try on the client side too, I suppose, to see if it makes any difference.)

I'm wondering if there is some goofiness concerning delayed acks...
There was a somewhat related post about delays over on the CocoaHTTPServer mailing list:

Also, what iOS version are you running on the iPod Touch?

-Robbie Hanson
-Deusty, LLC


--
You received this message because you are subscribed to the Google Groups "CocoaAsyncSocket" group.
To post to this group, send email to cocoaasy...@googlegroups.com.
To unsubscribe from this group, send email to cocoaasyncsock...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cocoaasyncsocket?hl=en.


JP May

unread,
May 7, 2011, 2:37:29 AM5/7/11
to cocoaasy...@googlegroups.com
Robbie, I truly thank you for your response.

In brief..

(*) I will try the Nagle aspect now, thank you

(*) iOS versions: the problem exhibits with all iOS versions we have on hand. With 4.3.3 (latest), same results

(*) I have a shortage of iPhone4 for testing: I do not know decisively if the problem shows with iPhone4. We have piles of everything else and (other than my lack of iPhone4s!) it's only the iPodTouch4

Anyway I will alert asap on Nagle......


WIth great thanks,
Fat Johnnie

JP May

unread,
May 7, 2011, 4:11:27 AM5/7/11
to cocoaasy...@googlegroups.com
Dear Robbie,


(1) I did try non-Nagling on both client and server, it does not affect the issue.

{As an unrelated point .. I have to believe if you are working with real-time connections, surely it's generally better to disable the Nagle algorithm? So thanks for that.}

(2) I have discovered that this is related to the HORRIBLE BLUETOOTH BUG.

The demo app I posted 100.0%, exhibits the HORRIBLE BLUETOOTH BUG every single time:

(a) if you turn Bluetooth ON on the client device: the connection does not work 100% of the time

(b) if you turn Bluetooth OFF on the client device: the connection does work flawlessly 100% of the time

(3) I believe there is a still a specific problem WRT the iPodTouch4Gen: I will keep researching this.

(4) To fix the Horrible Bluetooth Problem:

Is the solution: making sure the CLIENT uses ONLY wifi (strictly not Bluetooth)?

Does anyone know if this is correct, and possible?

Essentially, do I follow the example in InterfaceTestAppDelegate.m, using -(NSData *)wifiAddress and then the amazing new connectToAddress: method?

Or ........................ is one still buggered, merely by the fact that power is On to the Bluetooth antenna?

Thank you in advance if anyone knows.


Since real-time-CAS-networking does not work on iOS if Bluetooth is present, this problem must come up often I guess?? I am very, very sorry if I wasted anyone's time by repeating this issue.

Very kindly,
Fat Johnnie
SMHK

On 7 May 2011, at 05:38, Robbie Hanson wrote:

Shukuyen

unread,
May 7, 2011, 9:21:39 AM5/7/11
to CocoaAsyncSocket
Hi,

I posted to this group with this problem too, some time ago.
I tested with wifi only (using the added connect via interface
method), but that didn't help. The problem appeared on iPhone 3G, 3GS
and 4.

My solution was to switch to GCDAsyncSocket, this has improved things
quite a lot. It is not perfect yet (about 50/50 chance) but better
than before.

Bye,
Shukuyen
> >http://groups.google.com/group/cocoahttpserver/browse_thread/thread/5...
>
> > Also, what iOS version are you running on the iPod Touch?
>
> > -Robbie Hanson
> > -Deusty, LLC
>
> > On May 6, 2011, at 6:26 PM, JP May wrote:
>
> >> Hello, CocoaAsyncSocket list !
>
> >> CocoaAsyncSocket is about my favourite library, but we've found a horrible problem -- either in AsyncSocket, or, perhaps the underlying.
>
> >> The problem is described at length here:
>
> >>http://stackoverflow.com/questions/5917426/horrible-ipodtouch4-specif...
>
> >> You can play a video here ..http://www.mediafire.com/?rie4xpeeptgemvo
>
> >> or download a full demo here:
>
> >>http://www.mediafire.com/?a1cnkodxd5mna6c
>
> >> in short, performance is hideous with an iPodTouch4 as a client ..  nothing else!
>
> >> You can use either iPad, or any gen phone, etc, as a client, and it works flawlessly.
>
> >> How could this be?
>
> >> If you have an iPodTouch4, check it out.
>
> >> Thanks for any ideas,
> >> Fat Johnnie
>
> >> --
> >> You received this message because you are subscribed to the Google Groups "CocoaAsyncSocket" group.
> >> To post to this group, send email to cocoaasy...@googlegroups.com.
> >> To unsubscribe from this group, send email to cocoaasyncsock...@googlegroups.com.
> >> For more options, visit this group athttp://groups.google.com/group/cocoaasyncsocket?hl=en.

Bleicher Eiko

unread,
May 7, 2011, 7:13:16 AM5/7/11
to cocoaasy...@googlegroups.com
The question has been removed... any new insights?

Best,
Eiko

JP May

unread,
May 7, 2011, 12:22:11 PM5/7/11
to cocoaasy...@googlegroups.com
Dear Eiko,

(1) It turns out the primary problem is the dreaded "does not work if Bluetooth is turned on" problem.

(2) I tried non-Nagleing as described by R.H. -- sadly, no difference.

(3) Next, I am trying to specify WiFi-only, using connectToAddress:

(it's a nuisance to convert hostname and port to a sockaddr structure)

I will report back on the results of (3) !!!

The demo is quite useful, and you can get it here.. http://www.mediafire.com/?a1cnkodxd5mna6c


Kindly
Fat Johnnie

JP May

unread,
May 7, 2011, 5:00:13 PM5/7/11
to cocoaasy...@googlegroups.com
Dear Shukuyen,

You are right. I tried using 'connectToAddress' and specifying en0 so that only the ethernet is used for certain.

However, it makes absolutely no difference to the problem.

In retrospect, this makes sense: the problem seems to be basically interference from the Bluetooth antenna. The client-server was already using WiFi for sure (simply turn off BT on the server), so enforcing WiFi would make no difference -- it does make no difference.

I will try GCDAsyncSocket as you suggest. It sounds like it is not a fix though.

I am really mystified because: there DO EXIST one or two iPhone games, that allow a solid realtime WiFi connection ... even if the user leaves Bluetooth running.

On 7 May 2011, at 15:21, Shukuyen wrote:
> Hi,
> I posted to this group with this problem too, some time ago.
> I tested with wifi only (using the added connect via interface
> method), but that didn't help. The problem appeared on iPhone 3G, 3GS
> and 4.
> My solution was to switch to GCDAsyncSocket, this has improved things
> quite a lot. It is not perfect yet (about 50/50 chance) but better
> than before.
> Bye,
> Shukuyen

JP May

unread,
May 7, 2011, 5:04:29 PM5/7/11
to cocoaasy...@googlegroups.com
For real-time networking:


AsyncSocket does not work.

AsyncUdpSocket does not work.

AsyncSocket, with Nagling off does not work.

AsyncSocket using the new interface forcing does not work.

GCDAsyncSocket does not work.

In each of the five cases, it fails if the user has Bluetooth running on their device.

I can only say "WTH" ?!?


How the heck DOES one do realtime networking on iOS devices??!


- Fatty

Lou Zell

unread,
May 7, 2011, 5:48:34 PM5/7/11
to cocoaasy...@googlegroups.com
I answered that question with "Turn bluetooth off", which I see is what led to the stream of emails today!  I have run into this recently and filed a developer support incident for it.  I'm moving the sample projects that I wrote for it to github now and will post to the group.

Reply all
Reply to author
Forward
0 new messages