what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by Rocky » Wed, 18 May 2011 17:58:47 GMT


Sponsored Links
 Hi my code (red colored) is not responding, saying that time out,
please let me know where i'm doing wrong.

// Prepare a request object
        HttpGet httpget = new HttpGet(" http://10.91.28.203 ");

        // Execute the request
        HttpResponse response = null;

        JSONObject json = new JSONObject();
        System.out.println("result = " + result);
        System.out.println("json object " + json.toString());

        try {
            System.out.println("inside try 1");
            response = httpclient.execute(httpget);

-- 
Thanks & Regards

Rakesh Kumar Jha

-- 



Re: what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by neha jain » Wed, 18 May 2011 18:33:20 GMT


 Whereas i know with GET request data is send as part of url and JSONObject
is used with POST.





-- 


Sponsored Links


Re: what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by Kostya Vasilyev » Wed, 18 May 2011 18:36:15 GMT


 Possibly a real connection error?

The 10.* range is for private subnets, if the server is on your 
company's internal network, then it won't be visible through the phone's 
mobile data connection (as that would be coming from the outside).


-- Kostya

18.05.2011 14:33, neha jain ?????:
Whereas i know with GET request data is send as part of url and JSONObject is used with POST. On Wed, May 18, 2011 at 10:58 AM, Rocky <rkjhaw1...@gmail.com Hi my code (red colored) is not responding, saying that time out, please let me know where i'm doing wrong. // Prepare a request object HttpGet httpget = new HttpGet(" http://10.91.28.203 "); // Execute the request HttpResponse response = null; JSONObject json = new JSONObject(); System.out.println("result = " + result); System.out.println("json object " + json.toString()); try { System.out.println("inside try 1"); response = httpclient.execute(httpget); -- Thanks & Regards Rakesh Kumar Jha -- --
-- Kostya Vasilyev -- http://kmansoft.wordpress.com --



Re: what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by neha jain » Wed, 18 May 2011 18:38:57 GMT


 Add this line and try.
 HttpConnectionParams.setConnectionTimeout(client.getParams(), 5000);






-- 



Re: what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by Rocky » Wed, 18 May 2011 18:41:24 GMT


 thanks Kostya,

so how to test it, "localhost:2853" also not supported.
please let me know, my code is ok









-- 
Thanks & Regards

Rakesh Kumar Jha
Software Developer
Symphony Services Corp (India) Pvt Ltd
Bangalore
(O) +918030274295
(R) +919886336619

-- 



Re: what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by Kostya Vasilyev » Wed, 18 May 2011 18:51:38 GMT


 Localhost refers to your device's or the emulator's internal network - 
and that's probably not where your server is running.


Do you have INTERNET permission in the manifest?

If you do, two things to try:

- Open the URL with the device's web browser (or the emulator's);

- Use 'adb shell' and then 'ping' to check if the host is reachable.

-- Kostya

18.05.2011 14:41, Rocky :
thanks Kostya, so how to test it, "localhost:2853" also not supported. please let me know, my code is ok
-- Kostya Vasilyev -- http://kmansoft.wordpress.com --



Re: what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by Rocky » Wed, 18 May 2011 18:55:45 GMT


 Hi Kostya,

INTERNET permission is there,

i'm pinging host, but not reachable,
what to do








-- 
Thanks & Regards

Rakesh Kumar Jha
Software Developer
Symphony Services Corp (India) Pvt Ltd
Bangalore
(O) +918030274295
(R) +919886336619

-- 



Re: what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by Rocky » Wed, 18 May 2011 18:59:10 GMT


 10.91.28.203 its not reachable , but localhost is reachable, while
www.google.com is also not reachable from adb shell








-- 
Thanks & Regards

Rakesh Kumar Jha
Software Developer
Symphony Services Corp (India) Pvt Ltd
Bangalore
(O) +918030274295
(R) +919886336619

-- 



Re: what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by Kostya Vasilyev » Wed, 18 May 2011 19:08:02 GMT


 18.05.2011 14:58, Rocky :
10.91.28.203 its not reachable , but localhost is reachable, while www.google.com < http://www.google.com > is also not reachable from adb shell
Then your device is not configured to access the Internet. -- Kostya Vasilyev -- http://kmansoft.wordpress.com --



Re: what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by Diogo Salaberri » Wed, 18 May 2011 20:24:23 GMT


 // Create a default client HTTP
DefaultHttpClient cliente = new DefaultHttpClient();

// Set post or get method and set the URL
HttpPost post = new HttpPost("URL");

// Here you can set a parameter,
post.addHeader("Name", "Value");

// When you receive a response, you need to get this in a TRY/CATCH
try{
response = cliente.execute(post);
        HttpEntity entity = response.getEntity();
Out = EntityUtils.toString(entity);
}catch (Exception e) {
        // Do something with your exception
}

One more thing, if want to receive a JSON object, just use ( object =
(JSONObject) new JSONTokener(Out).nextValue(); ).. Cutting extra caracters
that isn't a JSON.

I hope can you enjoy this.. see you.

-- 
Atenciosamente;
Diogo Bonoto Salaberri
Bacharel em Cincia da Computao - UFPel

-- 



Re: what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by Rocky » Wed, 18 May 2011 20:28:16 GMT


 Hi
I'm not getting any response from below line.

response = cliente.execute(post);







-- 
Thanks & Regards

Rakesh Kumar Jha
Software Developer
Symphony Services Corp (India) Pvt Ltd
Bangalore
(O) +918030274295
(R) +919886336619

-- 



Re: what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by Diogo Salaberri » Wed, 18 May 2011 21:55:01 GMT


 verify your URL, are you requesting a local server our something like this ?








-- 
Atenciosamente;
Diogo Bonoto Salaberri
Bacharel em Cincia da Computao - UFPel

-- 



Re: what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by Vishal » Thu, 19 May 2011 02:50:47 GMT


 Little modification

HttpGet httpget = new HttpGet(" http://10.91.28.203 ");

    // Execute the request
     HttpResponse response = null;

     try {
       System.out.println("inside try 1");
       response = httpclient.execute(httpget);

         HttpEntity entity = response.getEntity();

         if(entity!=null)
         {
             BufferedReader reader = new BufferedReader(new
InputStreamReader(response.getEntity().getContent(), "UTF-8"));
            StringBuilder builder = new StringBuilder();
            for (String line = null; (line = reader.readLine()) !=
null;)
            {
                   builder.append(line).append("\n");
            }
           JSONTokener tokener = new JSONTokener(builder.toString());
           JSONArray finalResult = new JSONArray(tokener);

         }







-- 



Re: what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by Denis Shalagin » Thu, 19 May 2011 02:51:05 GMT


 Are you sure that ping for " http://10.91.28.203 " is OK?





-- 



Re: Re: what will be the parameter of HttpGet httpget = new HttpGet("http://10.91.28.203");

by Diogo Salaberri » Thu, 19 May 2011 03:50:15 GMT


 Your code is right, but can generate erros because, normally, the response
of a request have caracteres that can't be used like a native JSON. The
response string need to be looked more carefully, use subString is a hint.

bye

-- 
Atenciosamente;
Diogo Bonoto Salaberri
Bacharel em Cincia da Computao - UFPel

-- 



Other Threads

1. How to use jdb? "Deferring breakpoint ... It will be set after the class is loaded."



The VM doesn't really have a choice -- the de{*filter*}s I've tried expect
that, when they attach to a running VM, the VM will be *running*.  (I
filed a feature request against Eclipse for this a while back.)

However, it sounds like you have the opposite problem, in that the
class you're trying to set the breakpoint in doesn't appear to be
loaded.  The most common way to get this message is to get the class
name wrong or omit the package name, e.g. you try to break in class
Blah rather than com.foo.Blah.

Note in particular the jdb help message:

  stop at <class id>:<line> -- set a breakpoint at a line

That's "class id", not "filename".  Looking at
 http://www.***.com/ #JDWP_EventRequest_Set,
the only use of filenames is in SourceNameMatch events, which are only
for class prepare events (i.e. stopping when a class is loaded).  So I
suspect your problem is that you're specifying
"HelloWorldActivity.java" as the class name.  Replace it with the full
class name and try again.

--~--~---------~--~----~------------~-------~--~----~

2. ProGuard with Android 1.5

Hi,

Has anyone had any luck with using ProGuard on Android 1.5 projects?
The build.xml format changed significantly from earlier versions of
Android, making previous examples and discussions no longer helpful
(for example, here:

3. voicemail away message

4. How can i catch the notification from in built mail in mobile?

5. Where is the code of portable version of the dalvik interpreter

6. LinearLayout cuts off parts of my views! (MeasuredHeight problem?)

7. How to use jdb? "Deferring breakpoint ... It will be set after the class is loaded."