0

I have a REST API in go on my server VM, with gorilla/mux:

router := mux.NewRouter().StrictSlash(true)
log.Fatal(http.ListenAndServe(":49186", router))

I have an exposed IP and the domain forwarding set up on Godaddy as: [http://], [198.123.123.123:49186], Forward Type: Permanent (301), Settings: Forward Only

In my Kotlin I have:

val url = "http://example.com/getJSONitem/item%20name"
val q = Volley.newRequestQueue(this)
val request = JsonObjectRequest(Request.Method.Get, url, null, Response.Listener<JSONObject> { response ->
    textView.text = response.getString("Name")
    },
    Response.ErrorListener { error ->
        println(error)
})
q.add(request)

When I run this it hangs for a second and I get

I/System.out: com.android.volley.TimeoutError

BUT if I put the IP and port explicitly...

url = "http://198.123.123.123:49186/getJSONitem/item%20name"

...it works and I get my JSON object... At least that tells me that my server is listening. So it is either an issue with my Volley code or I have my DNS forwarding misconfigured, in which case this belongs on SE and I apologize. Thank you for reading.

P.S. I have also tried putting the port after the domain as follows, and receive the same timeout error.

url = "http://example.com:49186/getJSONitem/item%20name"
7
  • What is your domain name? What is the IP address your service listens on? (Why we ask for real information) – Michael Hampton Feb 18 at 23:33
  • My domain is wowahapp.com and the public IP is 35.193.69.215 and the port is 49155. I was troubleshooting earlier but just changed it back to having the port specified in the forwarding settings. I think it may take a minute to be effective. @MichaelHampton – craybobnee Feb 18 at 23:50
  • I see Hello World: Landing Page. Are you still having a problem? – Michael Hampton Feb 18 at 23:51
  • Yes, just re-confirmed. If I put the url wowahapp.com/getitem/Broken%20Fishing%20Pole in my browser it works, but in the android app I get volley.TimeoutError. If I use the more explicit 35.193.69.215:49155/getitem/Broken%20Fishing%20Pole it works in both my browser and the app. @MichaelHampton – craybobnee Feb 18 at 23:57
  • Looks like you're running into an issue with Kotlin rather than your server setup. You should follow this up on our sister site Stack Overflow which can help you debug your app. – Michael Hampton Feb 19 at 0:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.