【发布时间】:2012-06-04 20:51:10
【问题描述】:
我正在开发一个连接到服务器以获取一些数据的应用程序。
在这我想首先检查应用程序是否连接到服务器。然后,服务器是打开还是关闭?
根据结果,我想做进一步的操作。
那么我如何获得服务器状态的结果呢?
这是我正在使用的代码:
代码:
try {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(
"http://192.168.1.23/sip_chat_api/getcountry.php");
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
is = entity.getContent();
} catch (Exception e) {
}
【问题讨论】: