Closed gutisalex closed 2 years ago
The solution of this was using the IP of the wifi router instead of using its domainname. Eventhough I could use the domainname in the browser to still connect to the routers interface, the app on the other hand could not find the router anymore. I figured that out using DIO because I wanted to test if the http package not working correctly but apparently that was not the issue. After using the ip the error did not appear anymore on both clients (tested with one call that was causing the issue by 100%). My guess is something crashes with domain name resolution within flutter or even within the android sdk but that is going far over my knowledge... so I will close this issue for me!
Info
Device: Xiaomi Redmi 4 OS: MIUI Global 11.0.2 Flutter: 2.5.3 Dart: 2.14.4 http: 0.13.4
Description
I have built an app which is working along with an Alcatel Wifi Access router. The app is supposed to show infos about the reception, connected devices and the batterie of the router. The router is also capable of receiving SMS which can be fetched, read and replied. I use API polling to get the information and update it periodically every 30 seconds. The same goes with the sms but I fetch them every 2 seconds. I made this app so I don't need to use the web interface and so far its actually working well. But from time to time all my http calls are running into a socket exception and the only solution is turning off and on the wifi connection. But it is only the app that cannot reach the router anymore because if I use the browser and the web-interface everything is still working!
The problem is that this occurs totally random, sometimes it happens and I can reset the wifi connection and it will happen straight again but sometimes it just runs for hours without any problems.
It first looks like the http client just crashes for some reason but if it happens I can still make calls from out the app to the internet (over the wifi connection of the router). So my guess is that the http client closes the connection to the router only and discards all future calls until the wifi is being reset. Now I just need to figure out what it is causing this?! Do I make too many calls in too short period of time?
Code
This is my router_api_client.dart which is part of a bloc layer: