iOS의 Asyncsocket 클라이언트에서 작업 중입니다. 서버와 클라이언트 사이의 소켓 연결이 끊어 때iOS의 Asyncsocket 연결 해제 이벤트
https://github.com/robbiehanson/CocoaAsyncSocket
어떻게 알 수 있습니까?
연결을 감지하기 위해 어떤 대리인 메서드를 사용해야합니까?
감사합니다.
iOS의 Asyncsocket 클라이언트에서 작업 중입니다. 서버와 클라이언트 사이의 소켓 연결이 끊어 때iOS의 Asyncsocket 연결 해제 이벤트
https://github.com/robbiehanson/CocoaAsyncSocket
어떻게 알 수 있습니까?
연결을 감지하기 위해 어떤 대리인 메서드를 사용해야합니까?
감사합니다.
당신은 AsyncSocket.h을 읽어야가, 다음은을 (첫 번째 콜백 실제로 분리의 이유에 당신에게 정보를 줄 것이다 유용 할 수 있습니다)
/**
* In the event of an error, the socket is closed.
* You may call "unreadData" during this call-back to get the last bit of data off the socket.
* When connecting, this delegate method may be called
* before"onSocket:didAcceptNewSocket:" or "onSocket:didConnectToHost:".
**/
- (void)onSocket:(AsyncSocket *)sock willDisconnectWithError:(NSError *)err;
/**
* Called when a socket disconnects with or without error. If you want to release a socket after it disconnects,
* do so here. It is not safe to do that during "onSocket:willDisconnectWithError:".
*
* If you call the disconnect method, and the socket wasn't already disconnected,
* this delegate method will be called before the disconnect method returns.
**/
- (void)onSocketDidDisconnect:(AsyncSocket *)sock;
그것은 당신이 대리자 메서드를 사용하는 것이 나타납니다 : 매우 상단에
- (void)onSocketDidDisconnect:(AsyncSocket *)sock;
대단히 고마워요. – user403015
나는 서버가 닫힐 때이 메소드들 중 아무 것도 호출되지 않는다고 생각한다. :(나는 서버가 닫히고 있다는 것을 어떻게 알 수 있는지 모른다. – Geri