TIdTCPConnection.WriteStream裏while True do begin問題 |
答題得分者是:cmf
|
iamjsn
初階會員 發表:78 回覆:95 積分:44 註冊:2002-08-16 發送簡訊給我 |
下面我註解的地方有一段
while True do begin//不知這個true從那來的,怎麼用,怎麼判斷,謝謝
procedure TIdTCPConnection.WriteStream(AStream: TStream; const AAll: boolean = true; const AWriteByteCount: Boolean = False; const ASize: Integer = 0); var LBuffer: TMemoryStream; LSize: Integer; LStreamEnd: Integer; begin if AAll then begin AStream.Position := 0; end; // This is copied to a local var because accessing .Size is very inefficient if ASize = 0 then begin LStreamEnd := AStream.Size; end else begin LStreamEnd := ASize AStream.Position; end; LSize := LStreamEnd - AStream.Position; if AWriteByteCount then begin WriteInteger(LSize); end; BeginWork(wmWrite, LSize); try LBuffer := TMemoryStream.Create; try LBuffer.SetSize(FSendBufferSize); //問題:這個true是由那邊決定為true或false???-------------- while True do begin LSize := Min(LStreamEnd - AStream.Position, FSendBufferSize); if LSize = 0 then begin Break; end; // Do not use ReadBuffer. Some source streams are real time and will not // return as much data as we request. Kind of like recv() // NOTE: We use .Size - size must be supported even if real time LSize := AStream.Read(LBuffer.Memory^, LSize); if LSize = 0 then begin raise EIdNoDataToRead.Create(RSIdNoDataToRead); end; WriteBuffer(LBuffer.Memory^, LSize); end; finally FreeAndNil(LBuffer); end; finally EndWork(wmWrite); end; end; |
cmf
尊榮會員 發表:84 回覆:918 積分:1032 註冊:2002-06-26 發送簡訊給我 |
|
iamjsn
初階會員 發表:78 回覆:95 積分:44 註冊:2002-08-16 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |