Android http connection - multiple devices cannot connect the same server

I really need help here ...

I have a simple Android application that connects to my server to receive data via HTTPS.

Everything worked fine until I connected to the same server from another device (iOS or Android). I start to receive timeouts or connection denials or other errors depending on the library used (sometimes SSL acknowledgment)

  • I tried 2 Android apps on the same router - failed

  • I tried Volley, Retrofit, the normal http library - failed

  • If one device is connected via a cellular network and one is connected to Wi-Fi, it works fine. However, I have seen cases when it does not work even using 2 devices connected to the cellular network, and not Wi-Fi.

  • Easy to reproduce. one application is working fine. as soon as I do the operation on another device. the first application will not be able to connect.

  • An iOS application using the same api / server is working fine. without crashing

  • I skipped wirehark in an Android application in case of failure and got the following:

70 47.073286 10.0.0.1 10.0.0.138 ICMP 120 Destination not available (not available for the port)

Looks like port issues. I am no longer sure if this is a server problem or a client problem. The iOS app works great. no questions. Android only.

I tried:

System.setProperty("http.keepAlive", "false"); 

I tried setting the connection :close http header "nothing works ...

Any idea would be appreciated ...

+4
source share
4 answers

Same problem. When my ios device connects to allstar heroes or the running application, the device can not can not can connect more. I can not find a solution for this. My router is tp link dir 615. Perhaps the problem is with the frpm router.

0
source

In the end, it was a server problem. The IT guy gave me the following information: “Incorrect flag in tcp kernel settings” “Reconnecting”, that’s all I have for you. hope this can help someone else

0
source

I had the same problem. The problem was that the application was trying to access the ports in TIME_CLOSE here - a great explanation of how this happens, changing the tcp core for reuse can solve the problem, because the server will try to use this connection again in TIME_CLOSE. but it should be a client-side decision to avoid the connection, to get stuck. in my case, I tried to create a connection from multiple actions, and I assume that they somehow competed for opening and closing connections, I solved the problem using one action to connect to the server.

hope this is useful to someone.

0
source

If the exact same problem had been spent a lot of time, nothing helped to enable the "Reconnect" flag, I also tried to disable tcp_timestamp, tcp_tw_reuse, tcp_tw_recycle and enable vm safe mode for the application, as suggested here:

but everything is in a vein.

Moreover, it is very strange that I had two different instances / servers that I did exactly the same to track the problem, and one server did not have any problems.

So at the end:

Rebooting the instance resolves the connection problem. (or just need to restart the network service)

(c) My server / admin instance

0
source

Source: https://habr.com/ru/post/985588/


All Articles