Home > Back-end >  Flutter - Socket - SocketException Failed host lookup No address associated with hostname
Flutter - Socket - SocketException Failed host lookup No address associated with hostname

Time:09-30

My standard socket server works just fine. Internet connection is good. The code is good. The permissions are good. flutter doctor is also the best. http.get() even returned the perfect status code 200 response. All the issue is on client side the device not the server.

Socket socket = await Socket.connect('http://192.168.1.2', 5000);

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

I/flutter (13238): SocketException: Failed host lookup: 'http://192.168.1.2' (OS Error: No address associated with hostname, errno = 7)

What was I missing?. Greatly appreciate your help and thank you.

CodePudding user response:

No 'http://'.

Socket.connect('192.168.1.2', 5000)
  • Related