开发者

AsyncSocket works on my simulator but not my partner's - connection cancelled error

My partner and I have ch开发者_运维技巧ecked out the exact same code, and we are both using the same network.

When I try and connect to a socket using AsyncSocket, it works. When my partner does the exact same thing, it does not.

I have tried Googling but I have no traction. Any tips?


The answer to this questions is as follows.

When implementing the following delegate function, we did not return a value:

- (BOOL)onSocketWillConnect:(AsyncSocket *)sock;

If you don't expicitly return a value, what this function actually returns on any given device is non-deterministic (or at least impossible to calculate). On my machine, it happened to return true, and on my partner's it was false.

As usual, paying attention to the compiler warnings would solve this problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜