Skip to content

TCP Connection issues on iOS when app wakes up #1214

Answered by sreimers
gordongrech asked this question in Q&A
Discussion options

You must be logged in to vote

I think, this is nothing a library itself can handle. The recommended way is to listen for applicationDidEnterBackground and close all open connections.

Once your app goes into the background, it may be suspended. Once it is suspended, it's unable to properly process incoming connections on the listening socket. However, the socket is still active as far as the kernel is concerned. If a client connects to the socket, the kernel will accept the connection but your app won't communicate over it. Eventually the client will give up, but that might take a while.
Thus, it's better to close the listening socket when going into the background, which will cause incoming connections to be immediat…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@gordongrech
Comment options

@gordongrech
Comment options

Answer selected by gordongrech
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1213 on November 16, 2024 19:59.