Dio: Problem when request "localhost".

Created on 1 Oct 2018  ·  8Comments  ·  Source: flutterchina/dio

If i make a dio call like: http://127.0.0.1:8001, i get a dio error:

DioError [DioErrorType.DEFAULT]: SocketException: OS Error: Connection refused, errno = 111, address = 127.0.0.1, port = 45818

Dose dio not support port numbers ? - only a problem on localhost ?

Most helpful comment

@Mythar when you run adb reverse tcp:8080 tcp:8080 you can connect to localhost on your device it proxies your request to your local webserver 👍

All 8 comments

localhost stands for your phone, not your computer.

:octocat: From gitme Android

Same problem with: http://192.168.178.28:8080
Connection refused, errno = 111, address = 192.168.178.28, port = 48180

Same problem with normal http.post.. Looks like it has something to do with security for non-https urls.

Fixed it on my android device with running adb reverse tcp:8080 tcp:8080

@Mythar when you run adb reverse tcp:8080 tcp:8080 you can connect to localhost on your device it proxies your request to your local webserver 👍

@Mythar when you run adb reverse tcp:8080 tcp:8080 you can connect to localhost on your device it proxies your request to your local webserver 👍

thanks。谢谢

@Mythar when you run adb reverse tcp:8080 tcp:8080 you can connect to localhost on your device it proxies your request to your local webserver 👍

thanks a lot. it's really helpful!

how can i run adb reverse tcp:8080 tcp:8080 please?

Was this page helpful?
0 / 5 - 0 ratings