Serif İnanir
Serif İnanir

Reputation: 19

Flutter - Socket.Connect() - SocketException: OS Error: Connection timed out

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;

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.

Upvotes: 1

Views: 3520

Answers (1)

Serif İnanir
Serif İnanir

Reputation: 19

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.

Upvotes: 1

Related Questions