Nachtrag : mit folgendem Code bekomme ich eine
AV (siehe screen dump) warum kann ich auf den Stream nicht zugreifen ?
Delphi-Quellcode:
/// server read stream
function ReceiveStream(AContext: TIdContext; var AStream: TStream): Boolean; overload;
var
LSize: LongInt;
begin
try
LSize := AContext.Connection.IOHandler.ReadLongInt();
AContext.Connection.IOHandler.ReadStream(AStream, LSize);
Result := True;
except
Result := False;
end;
end;
/// client send stream
function SendStream(AClient: TIdTCPClient; AStream: TStream): Boolean; overload;
var StreamSize : LongInt;
begin
Result := True;
try
StreamSize := (AStream.Size);
AStream.Seek(0, soFromBeginning);
AClient.IOHandler.LargeStream := True;
AClient.IOHandler.SendBufferSize := 32768;
AClient.IOHandler.Write(LongInt(StreamSize));
AClient.IOHandler.WriteBufferOpen;
AClient.IOHandler.Write(AStream, StreamSize);
AClient.IOHandler.WriteBufferFlush;
finally
AClient.IOHandler.WriteBufferClose;
end;
Result := True;
end;