Re: [mailcore] How to cancel read operation on socket
- Matt Ronge
- 2013-06-28 @ 18:22
What I've done is to create a new connection each time the app becomes
active. The old connection I then close.
I found that trying to determine if a connection was "good" and reuse it
was too difficult. Instead I just open and close more often.
iPhone & iPad App Consultant
Central Atomics Inc.
On Jun 28, 2013, at 1:54 AM, Sergey Proforov <firstname.lastname@example.org> wrote:
> I have an issue when a socket thread is hangs up. For example:
> 1) app connects to mail server
> 2) user pressed home button on ios device
> 3) app goes to background mode and sets background expiration handler
> 4) app updates folders by timer every several minutes
> 5) when system executes background expiration handler, i'm trying to
disconnect every connection
> If disconnection time in background is too long - system kills app
because of watchdog.
> If I do not disconnect before the system suspends app, then later when
app goes to foreground i can't interact with this connection because
socket read operation is endless.
> How to cancel read operation without any of logout work, just close tcp
connectiom and release socket?
> Or any workaround for hangup?
> Best regards,
> Sergey Proforov.