API version 1

- ‐

abort

通信セッションを強制切断します。 引数を指定しない場合、すべてのセッションを切断します。

呼出形式一覧

呼出形式

説明

void abort()

すべての通信セッションを強制切断します。

void abort(string id)

指定の通信セッションを強制切断します。

戻り値一覧

戻り値

説明

void

なし

引数一覧

引数

説明

id

切断するセッションID

例外

識別子

説明

CRS::Common::Net::HttpAsyncSession-1:3

指定のIDのセッションはありません

関連項目

sessions プロパティ

isBusy メソッド



使用例 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;
   }
}