SocketException sometimes reports the incorrect port

Hello, I am trying to make a http get request with the following code:

        var uri = new Uri.http('10.125.32.128:10000', '/keyboard');
        print("Targeting " + uri.toString());
        http.get(uri).then((response) {
          print(response);
        });

In the console error, I unfortunately get this response:

flutter: Targeting http://10.125.32.128:10000/keyboard
[VERBOSE-2:shell.cc(184)] Dart Error: Unhandled exception:
SocketException: OS Error: Operation timed out, errno = 60, address = 10.125.32.128, port = 56325

I have assigned port 10000, but the error message says port 56325 is rejected. I have specified and seems to change the port number randomly that it’s targeting. Is there a different way I should be specifying the port #?

Note: I am using:

dev_dependencies:
  flutter_test:
    sdk: flutter
  http: ^0.12.0+1

Author: Fantashit

2 thoughts on “SocketException sometimes reports the incorrect port

  1. none of this actually worked for me :/
    this command worked like magic “adb reverse tcp:5000 tcp:5000” 💯

Comments are closed.