Hi I am trying to establish the connection between mobile and PC.I am
running server program on PC, when I run the below code server not
displaying any response message.When I send the request from mobile
browser server displaying response message. I am working on
SDK_1.1.Please suggest me on program
code........................................

public class HTTPPostExample extends Activity {
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
try{
httpPostImage();
}
catch(Exception e)
{}
}
}
public void httpPostImage() throws Exception {

HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://157.182.195.189:6666/";);

//File file = new File("/data/data/org.emrah/icon.png");
// InputStreamEntity reqEntity = new InputStreamEntity(new
FileInputStream(file), -1);


reqEntity.setContentType("application/x-www-form-urlencoded");

Header[] headers = new BasicHeader[2];
headers[0] = new BasicHeader("Accept","application/xml");
headers[1] = new BasicHeader("Content-type", "application/x-www-form-
urlencoded");
httppost.addHeader(headers[0]);
httppost.addHeader(headers[1]);

//httppost.setEntity(reqEntity);

System.out.println("executing request " + httppost.getRequestLine());
HttpResponse response = httpclient.execute(httppost);
HttpEntity resEntity = response.getEntity();

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to