Search code examples
objective-ccocoaasyncsocket

asyncsocket accepts socket but doesn't connect to host


I've just started running (what I thought was) a basic asyncsocket in my objective-c app and I'm getting the didAcceptNewSocket: message when connecting with telnet, but then I'm abruptly disconnected ("Connection closed by foreign host") without reaching the didConnectToHost: message. It works fine in the example and I've tried to replicate everything I see there to no avail.

Is there some simple pitfall I should be avoiding? Any other way I can debug this problem?


Solution

  • In this case, I was using the wrong delegate methods copied/pasted from some other site. Always check your headers!