1,593
社区成员
发帖
与我相关
我的任务
分享
function SendBuffer(Buffer:Pchar;BufferLen: Integer;Socket:TCustomWinSocket):Boolean;
var
P: PChar;
iLen,iSent: Integer;
begin
Assert(Buffer<>Nil);
Assert(Socket<>Nil);
Result := false;
if Not Socket.Connected then Exit;
P := Buffer;
iLen := BufferLen;
while iLen>0 do
begin
iSent := Socket.SendBuf(p^,iLen);
if iSent <= 0 then Exit;
Inc(p,iSent);
Dec(iLen,iSent);
end;
Result := true;
end;