Xojo Web quote example connection with Android

I’m trying the following code on an Android project:

Var conn As New URLConnection

Var content As String
content = conn.SendSync("GET", "http://127.0.0.1:8080/quote", 30)

System.DebugLog content

However I get the error message:
Failed to connect to /127.0.0.1:8080

Who web server runs locally in the debugger. Access is possible via the web browser. I have enabled port 8080 in fireball.
What am I doing wrong?

127.0.0.1 refers to the local computer, which in this case would be the Android device itself. That is not where the web server is running. Try using the actual IP address instead.

My guess is that Nobert is running a Xojo Web app locally using port 8080 and is available using the browser (http://127.0.0.1:8080) but when the above code is used the error message shows.

I suspect Paul is pointing out that the Android emulator has its own environment for 127.0.0.1

I searched Google for “android simulator 127.0.0.1” and found this answer: How do you connect localhost in the Android emulator? - Stack Overflow

3 Likes

Thank you Tim, I re-read what Paul wrote and now I think he is saying that the android device is using that IP too, so OP needs to use the actual computer IP and not 127.0.0.1.

2 Likes