0

Am trying to connect to connect flutter to local xampp, it executes with the above error, any help is appreciated

SocketException: OS Error: Connection timed out, errno = 110, address = 192.168.1.254, port = 38614

Leon Hagai
  • 69
  • 1
  • 1
  • 3

2 Answers2

0

1- if you are using emulator use 10.0.2.2 instead of 192.168.1.254

2- if you are using physical device make sure the device is connected to server first without the flutter app by accessing the ip of the server from your device or 10.0.2.2 if emulator

3- try disabling your firewall and antivirus

Moaid ALRazhy
  • 1,604
  • 1
  • 3
  • 13
0

Most likely your emulator doesn't have access to IP 192.168.1.254 on your host machine.

You can test this by opening up Chrome in your emulator and trying to visit: http://192.168.1.254

The Android emulator provides access to your host machine through IP 10.0.2.2. So if you have a website running at localhost (127.0.0.1) on your host machine, you should be able to access that from Android emulator Chrome browser using http://10.0.2.2

Android emulator also delegates DNS queries via 10.0.2.2. So if your host machine hosts file (C:\Windows\System32\drivers\etc\hosts or /etc/hosts on Mac) has domains specified (such as 192.168.1.254 myxampp) then you can edit your emulator's hosts file to delegate the domain lookup to your host machine hosts file using:

10.0.2.2 myxampp

Here are some instructions on how to edit your emulator's hosts file if you decide to go that route.

Baker
  • 24,730
  • 11
  • 100
  • 106