Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The connection errored: Connection refused This indicates an error which most likely cannot be solved by the library. #2069

Closed
ddxl123 opened this issue Dec 19, 2023 · 3 comments

Comments

@ddxl123
Copy link

ddxl123 commented Dec 19, 2023

Package

dio

Version

^5.4.0

Operating-System

Android

Output of flutter doctor -v

[√] Flutter (Channel stable, 3.16.3, on Microsoft Windows [Version 10.0.23601.1000], locale zh-CN)
    • Flutter version 3.16.3 on channel stable at D:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b0366e0a3f (2 weeks ago), 2023-12-05 19:46:39 -0800
    • Engine revision 54a7145303
    • Dart version 3.2.3
    • DevTools version 2.28.4
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at C:\Users\LongPC\AppData\Local\Android\Sdk
    • Platform android-33, build-tools 33.0.1
    • Java binary at: D:\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-9505619)
    • All Android licenses accepted.

[X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.5.3)
    • Visual Studio at D:\Microsoft Visual Studio
    • Visual Studio Community 2022 version 17.5.33516.290
    • Windows 10 SDK version 10.0.22000.0

[√] Android Studio (version 2022.1)
    • Android Studio at D:\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • android-studio-dir = D:\Android Studio
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-9505619)

[√] IntelliJ IDEA Ultimate Edition (version 2022.2)
    • IntelliJ at D:\IntelliJ IDEA 2022.2.2
    • Flutter plugin version 72.1.3
    • Dart plugin version 222.4560

[√] IntelliJ IDEA Ultimate Edition (version 2023.2)
    • IntelliJ at D:\IntelliJ IDEA 2023.1.4
    • Flutter plugin version 76.3.4
    • Dart plugin version 232.8660.129

[√] Connected device (3 available)
    • M2011K2C (mobile) • 198e9c6 • android-arm64  • Android 13 (API 33)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.23601.1000]
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 121.0.2277.4

[√] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.
Process finished with exit code 0

Dart Version

3.2.3

Steps to Reproduce

request

Expected Result

Android emulator works normally on the computer, but when using Android phone USB connection to the computer, the following error occurs:

DioException [connection error]: The connection errored: Connection refused This indicates an error which most likely cannot be solved by the library.
Error: SocketException: Connection refused (OS Error: Connection refused, errno = 111), address = 10.11.7.118, port = 45916

Actual Result

Normal

@ddxl123 ddxl123 added h: need triage This issue needs to be categorized s: bug Something isn't working labels Dec 19, 2023
@kuhnroyal
Copy link
Member

The connection was refused by your server or something in between. As the error message says, this is very likely a not a problem in dio. Please share a reproducible sample otherwise and reopen the issue with the sample.

@kuhnroyal kuhnroyal closed this as not planned Won't fix, can't repro, duplicate, stale Dec 19, 2023
@AlexV525 AlexV525 added i: not related and removed h: need triage This issue needs to be categorized s: bug Something isn't working labels Dec 19, 2023
@DevIdol
Copy link

DevIdol commented May 8, 2024

Don't use localhost, use your ip address.
To get ip address, hit enter ipconfig in cmd(in windows)

IPv4 Address 192.16.22.30
Eg:
http://192.16.22.30:8000/api/v1/

@vashukarn
Copy link

The issue can be using "http" instead of "https"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants