API version 1
- ‐
R
integer
sessions¶
現在HttpAsyncSessionオブジェクトが保持しているセッション数を取得します。
このセッション数はアクティブ、非アクティブなもの両方を含みます。
アクティブなセッションのみを確認したい場合は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;
}
}