首页 > 其他 > 详细

TBytes缓存多包数据

时间:2020-07-08 09:15:47      阅读:75      评论:0      收藏:0      [点我收藏+]

TBytes缓存多包数据

收到一个包,就追加进TBytes缓存,直到全部收完,再处理。

procedure bytesAppendBuf(var bytes: TBytes; const buf: Pointer; count: Integer);
var
  newSize, pos: integer;
begin
  pos := Length(bytes);
  if pos = 0 then
    newSize := count
  else
    newSize := pos + count;
  SetLength(bytes, newsize);
  Move(buf^, bytes[pos], count);
end;

  

TBytes缓存多包数据

原文:https://www.cnblogs.com/hnxxcxg/p/13264786.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!