1

When I was working on debug mode (with "flutter run") by using my device (real), Socket.Connect() method doesn't work.

Also I would like to say that this Connect method is in "dart:io" library.

In shortly;

  • I opened a server (TCP) with Python.

  • I wrote the Flutter client like below to be able to connecting to the server in Python.

    Future den() async { print("Started"); Socket sock = await Socket.connect("192.168.0.159", 5431); print("Done +++++++++++++++++++++++++"); }

However, I took a SocketError as Connection time out.

The error message I took:

E/flutter (17655): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: SocketException: OS Error: Connection timed out, errno = 110, address = 192.168.0.159, port = 43836

NOTE: I tried to change the manifest file by adding INTERNET permission, but it is not working.

1 Answer 1

1

It was a strange problem, because there is no problem the code I shared. Windows Defender performed a rule to block to open a port as server. Hence, I started the server on my machine, however, I couldn't connect it from my Android device.

Maybe, the error code that is shown by Flutter isn't clear. If you took a error about socket programming for connection or binding, looking to Defender (or firewall) can be affective method. Unfortunately, as I was just starting to learn Flutter, I thought of checking out Defender afterwards.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.