rest - Android app fails to ping static ip of machine on same WLAN -


I have a lush service that runs on my tower and my house is connected to wifi. I know that the service work Because I can curl up on WiFi from a different laptop and get the right data:

  curl-g "http://192.168.1.2:8080/ some / Cool " 

I have created an Android app that does the same GET I have made an asyncascus that uses the Apache HTTP Client Library Which comes with Android API1:

  @ Override protected input stream image background (zero ... parameter) {InputStream result = null; {HttpClient httpClient = Try New DefaultHttpClient (); HTTP Gate Mill = New HTTPAgent ("http://192.168.1.2:8080/Summing / Coal"); HTTPReponse response = httpClient.execute (get); If (response! = Null & feedback .getStatusLine (). GetStatusCode () == HTTPTitas.Sc_OK) {buffer HTTPT buffer HTTPTE = new bufferHPTPTY (responsiveGetientity ()); Result = bufferedHttpEntity.getContent (); } Else {// Insert Error Handling}} Grip (Exception e) {reportError (e.getMessage ()); } Return results; }  

Permissions in my manifest:

  Use of Android-permission: name = "android.permission.ACCESS_NETWORK_STATE" /> & Lt; Usage-permission Android: name = "android.permission.ACCESS_WIFI_STATE" / & gt; & Lt; Usage-permission Android: name = "android.permission.WRITE_SETTINGS" /> & Lt; Usage-permission Android: name = "android.permission.CHANGE_WIFI_STATE" /> & Lt; Usage-permission Android: name = "anroid.permission.INTERNET" />  

Installing the app on my Samsung S4 and connecting with my WiFi, I expected it to work. When httpClient.execute (received) is implemented, it kicks back:

Connection to http://192.168.1.2:8080

At first I thought this was my app, but then I used the Pinger app to ping a single IP from my device and it failed. So now I think this is my phone, or at least am starting the settings on my phone. Also, when I pinged google.com, the app said that my host IP 173.XXX.XXX.XXX

I tried to make some WiFi settings available to me, I switch the IP setting to frustration with DHCP, and it does not help.

Has anyone been on this issue?

Update 1: A suggestion from one of my friends, I completely shut down the firewall on my server, and I was able to ping my phone using it. I tried GAT again and I refused the same connection. I see why my request is wrong.

Update 2: I have typed an Android spell incorrectly in "anroid.permission.INTERNET". My IDE was screaming about me about it, but I did not pay attention. Tried to get Google.com, did the work 192.168.1.2:8080 / tried to get Sommy / Kaul, worked, tried to turn back my firewall and then GET worked.

typo "anroid.permission.INTERNET" ". It is fixed and works as expected .


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -