简体   繁体   中英

problem in connecting to my EC2 instance from android simulator

i am facing strange problem i deployed a webservice in EC2 which is up and working fine, but when i am trying to do a REST request on these service I am getting java.net.SocketException: The operation timed out. When i am trying the same URL in my laptop browser it is working but when i am trying this in Android emulator browser it is giving me error.

here is my code

REST URL: http://122.248.194.88:8080/data_for?train=12657

code:-

DefaultHttpClient httpclient = new DefaultHttpClient();
HttpGet httpget = new HttpGet("http://122.248.194.88:8080/data_for?train=12658"); 

        // Execute the request
        HttpResponse response;
        try {
            response = httpclient.execute(httpget);

`

this httpclient.execute is returning the socket exception is there anything more which i need to know??

I am behind a proxy though but i set that proxy in eumulator options while starting the emulator.

I used the example here: http://www.javacodegeeks.com/2011/01/android-json-parsing-gson-tutorial.html to consume a JSON string. It works perfectly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM