connectTimeout is not working when device is connected to a wifi which is not connected to internet
New Issue Checklist
- I have searched for a similar issue in the project and found none
Issue Info
| Info | Value | |
|---|---|---|
| Platform Name | e.g. flutter | |
| Platform Version | e.g. 1.12.13 | |
| Dio Version | e.g. 3.0.8/3.0.9 | |
| Repro rate | e.g. all the time (100%) |
Issue Description and Steps
my app is linked to a Wifi which is not connected to internet. and i set the connnect timeout to 2 seconds. but the dio took almost 2 minutes to timeout.
i try it on dio 3.0.4/3.0.8/3.0.9, they all have the same problem
my debug info is below: I/flutter (25438): [debug], [DioCloud], [Wed, 22 Apr 2020 06:10:57 GMT], request get, uri=/app/user/feedbacks, data=null, params={current: 1, size: 30}, headers=null
I/flutter (25438): connectTimeout, 2000 I/flutter (25438): {content-type: application/json; charset=utf-8, Authorization: eyJhbGciOyk}
I/flutter (25438): [debug], [DioCloud], [Wed, 22 Apr 2020 06:12:02 GMT], uri=/app/user/feedbacks, e=DioError [DioErrorType.DEFAULT]: SocketException: Failed host lookup: 'api.lebai.ltd' (OS Error: No address associated with hostname, errno = 7)
I/flutter (25438): [debug], [DioCloud], [Wed, 22 Apr 2020 06:12:02 GMT], e response=null
me too!The platform is ios, android is ok!
me too!The platform is ios, android is ok!
my is Android. are you in the same situation? linked to a wifi which is not connected to the Internet?
Adjust the DNS network to 8.8.8.8. After opening the APP and running normally, change it to default DNS and everything is ok.
you have the same situation before? why is the DNS problem? I can't let my user to change their wifi's DNS setting, it seems not a very good solution.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, please make sure it is up to date and if so, add a comment that this is still an issue to keep it open. Thank you for your contributions.
i meet the same question.when i disconnect from the internet,i can't see the connectTimeout.and when i connect to the internet, the task doesn't begin.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, please make sure it is up to date and if so, add a comment that this is still an issue to keep it open. Thank you for your contributions.