Home > Mobile >  The background why long socket connection will automatically disconnect
The background why long socket connection will automatically disconnect

Time:12-05

Detailed said, the question is this: in a project need to use a socket connection, long now maintain a service as a socket connection to send and receive messages, but the tests found that once the app exit, that has been returned, back to the mobile phone desktop, then the socket have disconnected with four or five minutes or so, heartbeat packets half a minute at a time, the service is running, and then try again but not, only hint even without overtime; If you don't turn off the app interface, press the home key can also be, not completely out of the app, the socket can always send and receive messages, there are two problems have been not sure, one is why the app socket retreated to the background will be broken, what did whether system limit, is another socket disconnect reconnection why even not, is also the service in the background, but once opened the app, because the service is running, so not to create, but this time the socket can be connected... Who have encountered similar or any direction: no, I don't ask baidu ask API documentation can find the solution, no points can be used, such as I brush to fill the

CodePudding user response:

There is no error output reconnection is not

CodePudding user response:

Press the return key, the app's main process was killed, if there is no set service is run in the main process

CodePudding user response:

reference 1st floor zijiang001 response:
heavy aren't even there is no error output
reconnection is not on the tip is connection timeout

CodePudding user response:

reference x443137254 reply: 3/f
Quote: refer to 1st floor zijiang001 response:

Reconnection is not no error output
reconnection is not prompt is on connection timeout

May be a permissions problem, look at whether to disable the background connected to the Internet

CodePudding user response:


1. Look at the picture Settings, different models may have difference,
2. Add the battery white list, many on the net, don't copy,
3. Suggest each time you upload to add log, print the current network is normal connection,
4. Confirm didn't kill the process

CodePudding user response:

Brother I met this problem, now also don't know brother did you solve
  • Related