Delphi-Quellcode:
// Server
procedure TEmpfangsForm.TCPReceiverExecute(AContext: TIdContext);
var FSTream : TFileStream;
SizeOfIncomingStream : Integer;
IDS : TidStreamVCL;
begin
FStream := TFileStream.Create(DateiName, fmCreate);
IDS := TidStreamVCL.Create(FStream);
with AContext.connection do
begin
try
SizeOfIncomingStream := Socket.ReadInteger;
Socket.ReadStream(IDS, SizeOfIncomingStream);
finally
Disconnect;
end;
end;
IDS.VCLStream.Position := 0;
FStream.Free;
IDS.Free;
// (Weitere Behandlung der Datei)
end;
So funktioniert es endlich