hi All,
as per attached i am getting a range check error while writing the response to a request in a socket.
please advise on why the error would appear.
this is my first sockets unit, i am learning...
thank you
function TWeb.sWrite(AMsg: string): string;
var
i: cardinal;
s: integer;
begin
try
s := Length(AMsg);
if s < packet_size then
i := s
else
i := packet_size;
writeln('start write');
while s > 0 do
begin
fpsend(_ASocket, PChar(AMsg), i, 0);
Delete(AMsg, 1, i);
s := s - packet_size;
if s < packet_size then
i := s;
end;
writeln('finish write');
except
on E: Exception do
begin
writeln('error write: ' + E.Message);
Result := E.Message;
end;
end;
end;