分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 运营维护

indy10的idhttpServer应答字符串

发布时间:2023-09-06 02:08责任编辑:白小东关键词:http

indy10的idhttpServer应答字符串

先看应答字符串的代码:

procedure TIdIOHandler.Write(const AOut: string; AByteEncoding: IIdTextEncoding = nil ?{$IFDEF STRING_IS_ANSI}; ASrcEncoding: IIdTextEncoding = nil{$ENDIF} ?);begin ?if AOut <> ‘‘ then begin ???AByteEncoding := iif(AByteEncoding, FDefStringEncoding); ???{$IFDEF STRING_IS_ANSI} ???ASrcEncoding := iif(ASrcEncoding, FDefAnsiEncoding, encOSDefault); ???{$ENDIF} ???Write( ?????ToBytes(AOut, -1, 1, AByteEncoding ???????{$IFDEF STRING_IS_ANSI}, ASrcEncoding{$ENDIF} ???????) ?????); ?end;end;

  从代码可以看出,发送字符串,最终是将字符串转为TidBytes,发送的。

再跟一下发送TidBytes的代码:

procedure TIdIOHandler.Write(const ABuffer: TIdBytes; const ALength: Integer = -1; ?const AOffset: Integer = 0);var ?LLength: Integer;begin ?LLength := IndyLength(ABuffer, ALength, AOffset); ?if LLength > 0 then begin ???if FWriteBuffer = nil then begin ?????WriteDirect(ABuffer, LLength, AOffset); ???end else begin ?????// Write Buffering is enabled ?????FWriteBuffer.Write(ABuffer, LLength, AOffset); ?????if (FWriteBuffer.Size >= WriteBufferThreshold) and (WriteBufferThreshold > 0) then begin ???????repeat ?????????WriteBufferFlush(WriteBufferThreshold); ???????until FWriteBuffer.Size < WriteBufferThreshold; ?????end; ???end; ?end;end;

  大的BUF,会分成N次陆续发送。所以INDY发送大字符串无须担心什么。

indy10的idhttpServer应答字符串

原文地址:https://www.cnblogs.com/hnxxcxg/p/10265227.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved