That would have been much easier to read if you wrapped with it CODE tags!
I take it that the code you posted is the code that works but takes a long time? Can you post the code that is fast but doesn't work too, this time in CODE tags
The ConnectionManager class I wrote looks very similar to your code, so may be of some help. I posted in the forum:
Max IO Connections on device but not simulator?