API version 1

- ‐

isBusy

セッションが通信中かどうか調べます。

引数を指定しない場合、1つでも通信中のセッションが存在すればtrueとなります。

このメソッドでは存在しないセッションIDを指定しても例外は発生せずfalseを返します。

呼出形式一覧

呼出形式

説明

boolean isBusy()

通信中のセッションが存在するかを調べます。

boolean isBusy(string id)

指定のidのセッションが通信中か否かを調べます。

戻り値一覧

戻り値

説明

boolean

通信中であればtrueを、そうでなければfalseを返します。

引数一覧

引数

説明

id

セッションIDを指定します。

例外

なし

関連項目

sessions プロパティ

abort メソッド



使用例 CRSダウンロード

Form HTTPAsync1 {
   X = 0;
   Y = 0;
   width = 681;
   height = 441;
   Number id_num = 0;
   reference ref;

   httpAsyncSession asyncSession{
           Function OnSessionEnd( e ) {
                   ^.edtResult += "ID=" + e.id + " / ステータスコード=" + Str(e.status) +
                           " message=" + e.message + "\r\n";
                   ^.numSessionCount.Value = ^.asyncSession.sessions;
           }
   }

   Label Label3 {
           x = 15;
           y = 9;
           width = 338;
           Height = 20;
           Value = "非同期通信機能(ダウンロードボタンを複数回押します)";
   }

   TextBox txtURL {
           x = 14;
           y = 33;
           Width = 372;
           Height = 20;
           Value = "http://httpbin.org/image/png";
   }

   Button btnDownload {
           x = 15;
           y = 70;
           width = 102;
           Height = 30;
           Title = "ダウンロード(Get)";
           Function OnTouch( e ) {
                   try {
                           ^.id_num++;
                           print("通信中 ",^.asyncSession.isBusy() ) ;
                           ^.asyncSession.get("No." + Str(^.id_num), ^.txtURL.value);
                           ^.numSessionCount.Value = ^.asyncSession.sessions;
                   } catch(e) {
                           MessageBox("No." + Str(^.id_num) + " : Message=" + str(e.Message) + "\nCategory=" + str(e.Category) + "\nCode="+ str(e.Code)  + "\nSubCode=" + str(e.subCode));
                   }
                   Title = "ダウンロード(Get) : " + Str(^.id_num);
                   SetTimer(10);
           }
   }

   Label Label11 {
           x = 129;
           y = 78;
           width = 66;
           height = 24;
           Value = "sessions =";
   }

   NumberEdit numSessionCount {
           x = 196;
           y = 70;
           Width = 44;
           Height = 30;
           BgColor = Color.YELLOW;
   }
   Label Label13 {
           x = 15;
           y = 113;
           width = 404;
           Height = 18;
           Value = "ダウンロードの結果(ダウンロードが終了するとセッションが開放されます)";
   }
   EditBox edtResult {
           x = 16;
           y = 133;
           width = 385;
           height = 122;
   }
   Button Btn_abort {
           x = 254;
           y = 70;
           Width = 62;
           Height = 30;
           Title = "abort";

           Function OnTouch( e ) {
                   try{
                           ^.asyncSession.abort();
                   } catch( e ){
                           MessageBox("No." + Str(^.id_num) + " : Message=" + str(e.Message) + "\nCategory=" + str(e.Category) + "\nCode="+ str(e.Code)  + "\nSubCode=" + str(e.subCode));
                   }
           }
   }
   Button Btn_Reset {
           x = 322;
           y = 70;
           Width = 62;
           Height = 30;
           Title = "Reset";

           Function OnTouch( e ) {
                   ^.edtResult.Clear();
                   ^.id_num = 0;
                   ^.btnDownload.Title ="ダウンロード(Get)";
                   ^.btnDownload.RemoveTimer();
           }
   }

   Function OnTimer(e){
           numSessionCount.Value = asyncSession.sessions;
   }
}