Hello, I wrote a min program that is suppose to send files, but it is telling me, "Error: Send buffer full, try again later." I am not sure why. Here is the code that sends file.
const
BufferSize = 1024;
var
Fs: TFileStream;
TotalCount: Integer;
Buffer: Pointer;
BytesToRead: Integer;
begin
Fs := TFileStream.Create('pathtoyourfile', fmOpenRead or fmshareDenyWrite);
try
TotalCount := 0;
GetMem(Buffer, BufferSize);
repeat
if TotalCount + BufferSize > Fs.Size then
BytesToRead := FS.Size - TotalCount
else
BytesToRead := BufferSize;
Fs.Read(Buffer^, BytesToRead);
aSocket.Send(Buffer, BufferSize);
TotalCount := TotalCount + BytesToRead;
until TotalCount >= FS.Size;
FreeMem(Buffer);
finally
Fs.Free;
end;
end;
Any hints or help will be greatly appreciated.