stablekernel / aqueduct

Dart HTTP server framework for building REST APIs. Includes PostgreSQL ORM and OAuth2 provider.
https://aqueduct.io
BSD 2-Clause "Simplified" License
2.41k stars 279 forks source link

E/flutter ( 8493): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: SocketException: OS Error: Connection refused, errno = 111, address = localhost, port = 39292 #645

Closed ghost closed 5 years ago

ghost commented 5 years ago

I got this Error when I try to run your todo App. => Pixel 3 XL The question is where I have to change this Information address = localhost, port = 39292.

I've changed every localhost what i cloud find in this Project.

adamtang79 commented 5 years ago

connection refused + localhost means flutter can't reach aqueduct. Either they are not on same network or firewall port isn't open. If both are inside your pc it will be your pc ip eg. 192.168.0.2. Edit: aqueduct default port is 8888 I believe through aqueduct create.

ghost commented 5 years ago

Thanks for the fast Answer an congrats for the Huge Application.

I check everything but let us show it together:

1) Firewall

2) IP PC

Drahtlos-LAN-Adapter WLAN:

   Verbindungsspezifisches DNS-Suffix: home
   Beschreibung. . . . . . . . . . . : Intel(R) Dual Band Wireless-AC 8265
   Physische Adresse . . . . . . . . : D4-6D-6D-62-4B-75
   DHCP aktiviert. . . . . . . . . . : Ja
   Autokonfiguration aktiviert . . . : Ja
   IPv4-Adresse  . . . . . . . . . . : 192.168.0.220(Bevorzugt)
   Subnetzmaske  . . . . . . . . . . : 255.255.255.0

3) IP Pixel 3 XL

192.168.0.220 => ping 192.168.0.234

Ping wird ausgeführt für 192.168.0.234 mit 32 Bytes Daten: Antwort von 192.168.0.234: Bytes=32 Zeit=512ms TTL=64 Antwort von 192.168.0.234: Bytes=32 Zeit=327ms TTL=64 Antwort von 192.168.0.234: Bytes=32 Zeit=569ms TTL=64

4) Flutter Doctor

[√] Flutter (Channel dev, v1.3.10, on Microsoft Windows [Version 10.0.17134.648], locale de-DE) • Flutter version 1.3.10 at C:\flutter • Framework revision 4feefa3c9a (4 days ago), 2019-03-14 10:21:03 -0400 • Engine revision 8b1a299ed5 • Dart version 2.2.1 (build 2.2.1-dev.1.0 674fd0e060)

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3) • Android SDK at XXX\AppData\Local\Android\sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-Q, build-tools 28.0.3 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01) • All Android licenses accepted.

[√] Android Studio (version 3.3) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin version 33.4.1 • Dart plugin version 182.5215 • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[√] Connected device (1 available) • Pixel 3 XL • 88XY02ZR8 • android-arm64 • Android Q (API 28)

• No issues found!

5) Error on Pixel 3 XL

6) Error in Android Studio

Launching lib\main.dart on Pixel 3 XL in debug mode... Initializing gradle... Resolving dependencies... Running Gradle task 'assembleDebug'... Built build\app\outputs\apk\debug\app-debug.apk. Syncing files to device Pixel 3 XL... W/IInputConnectionWrapper( 7744): getTextBeforeCursor on inactive InputConnection W/IInputConnectionWrapper( 7744): getSelectedText on inactive InputConnection W/IInputConnectionWrapper( 7744): getTextAfterCursor on inactive InputConnection E/flutter ( 7744): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: SocketException: OS Error: Connection refused, errno = 111, address = localhost, port = 44802 E/flutter ( 7744): null E/flutter ( 7744): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: SocketException: OS Error: Connection refused, errno = 111, address = localhost, port = 44802 E/flutter ( 7744): null Lost connection to device.

7)

Aqueduct Server:

database: username: todo password: todo host: 192.168.0.220 port: 5432 databaseName: todo_app

Port: 8888

[INFO] aqueduct: Server aqueduct/1 started. [INFO] aqueduct: Server aqueduct/2 started. [INFO] aqueduct: Server aqueduct/3 started. [INFO] aqueduct: Server aqueduct/4 started.

8)

In GOLANG I use this

func Cors(next http.HandlerFunc) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) {

    w.Header().Set("Access-Control-Allow-Origin", "*")
    w.Header().Set("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE")
    w.Header().Set("Access-Control-Allow-Headers", "Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization")

    next.ServeHTTP(w, r)
}

}

to avoid CORS Problems.

It's possible the I have this Problems because of CORS?

joeconwaystk commented 5 years ago

Your error log is showing that the Flutter install process is failing. Closing this issue.

ghost commented 5 years ago

When you mean this error

W/IInputConnectionWrapper(22484): getTextBeforeCursor on inactive InputConnection W/IInputConnectionWrapper(22484): getSelectedText on inactive InputConnection W/IInputConnectionWrapper(22484): getTextAfterCursor on inactive InputConnection

I got this when I type into the username field. When I start your Application it looks like this

Launching lib\main.dart on Pixel 3 XL in debug mode... Initializing gradle... Resolving dependencies... Running Gradle task 'assembleDebug'... Built build\app\outputs\apk\debug\app-debug.apk. Syncing files to device Pixel 3 XL...

When I type in username I got this error.

I'm pretty sure that you experience with Flutter is huge. But after 30 Years experience I feel that this is not the Problem.

But nevertheless. Thanks.

ThitSarNyanLynn commented 5 years ago

Change localhost to IPV4 address