0

I'm running a HttpServer instance on the simulator or the phone and cannot access it with the phone's/simulator's IP from the outside, only with http://localhost:3001 from the device.

Do I miss a configuration step or do I need another permission besides android.permission.INTERNET?

The current state is in this branch: https://github.com/elsamuko/clusterup/blob/features/LoadSaveJSON/lib/server.dart

7
  • 1
    Is the phone using wifi or its sim card? Commented Apr 17, 2020 at 13:25
  • I'm testing with WIFI. Commented Apr 17, 2020 at 13:31
  • Then the client can just use the local ip address of the server device. Assuming the client is in the same wifi network. Commented Apr 17, 2020 at 13:32
  • I tried to access the web server with the phone's IP and get no answer. It doesn't work from the dev computer or the phone itself. Commented Apr 17, 2020 at 13:36
  • HttpServer.bind(InternetAddress.loopbackIPv4. Well you bound your server to localhost/127.0.0.1. Dont do that. You should not bind your server to any ip address to begin with. Commented Apr 17, 2020 at 13:37

1 Answer 1

2

Do not bind your server to an ip address.

Let it float free.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.