接続ステータスを確認するために、次の関数を作成しました。
private void checkConnectionStatus() {
HttpClient httpClient = new DefaultHttpClient();
try {
String url = "http://xxx.xxx.xxx.xxx:8000/GaitLink/"
+ strSessionString + "/ConnectionStatus";
Log.d("phobos", "performing get " + url);
HttpGet method = new HttpGet(new URI(url));
HttpResponse response = httpClient.execute(method);
if (response != null) {
String result = getResponse(response.getEntity());
...
実行をテストするためにサーバーをシャットダウンすると、行で長時間待機します
HttpResponse response = httpClient.execute(method);
待ち時間が長すぎるのを避けるためにタイムアウトを設定する方法を知っている人はいますか?
ありがとう!