How to fix 'SocketException: OS Error: Connection timed out, errno = 110, address = 192.168.5.10, port = 49590' error in flutter

avatar
3238    1 year ago

I m trying to connect my android app to a Tcp iot server,first i connect to the tcp server using wifi then try socket connect but it is showing same error of connection timed out.

      print(r);
    }).catchError((e) {
      print(e);
    });

wifi connects without any error.


Socket.connect("192.168.5.10", 5800).then((socket) {
    print('Connected to: '
      '${socket.remoteAddress.address}:${socket.remotePort}');
    socket.destroy();
  });

Here it shows Unhandled Exception: SocketException: OS Error: Connection timed out, errno = 110, address = 192.168.5.10, port = 49590

Answers { 1 }
avatar
1 year ago

Just Connect wifi connects without any error.


Socket.connect("192.168.5.10", 5800).then((socket) {
    print('Connected to: '
      '${socket.remoteAddress.address}:${socket.remotePort}');
    socket.destroy();
  });

Here it shows Unhandled Exception: SocketException: OS Error: Connection timed out, errno = 110, address = 192.168.5.10, port = 4959