You need to make yourself a delegate and handle the onSocket: willDisconnectWithError: method. The connection is completely asynchronous, therefore, if there is no fundamental system problem (the sockets are disconnected, you passed an invalid address, etc.), then the call will always be successful if the attempt to connect the socket occurs in the background.
If this attempt fails, the onSocket: willDisconnectWithError: delegate method will be called so that you can find out that the connection attempt failed.
I'm not sure why, but the AsyncSocket class thinks that the status of the kCFStreamStatusError stream is "connected", so I suspect that is why it appears to be connected. You can follow all of this in the AsyncSocket source.
source share