Hallo ihr lieben.
Ich habe ein Problem mirt der Datenübertragung eines Filestreams.
Wenn ich vom client Daten an den Server sende die bis 2 GB groß sind, ist alles OK.
Ab 2GB großen Dateinen gibts nen Socket error (10054).
Hier mal etwas code:
Client
Delphi-Quellcode:
var
AStream: TFileStream;
begin
if OpenDialog1.Execute then
begin
AStream := TFileStream.Create(OpenDialog1.Filename,
fmOpenRead + fmShareDenyNone);
try
IdTCPClient1.IOHandler.LargeStream := True;
IdTCPClient1.IOHandler.SendBufferSize := 32768;
IdTCPClient1.IOHandler.WriteLn('FILE'); // send command "FILE"
IdTCPClient1.IOHandler.WriteLn(ExtractFilename(OpenDialog1.Filename)); // send file name
IdTCPClient1.IOHandler.WriteLn(IntToStr(AStream.Size)); // send file size
mClientLog.Lines.Add('Sending file "' + ExtractFilename
(OpenDialog1.Filename) + '"');
IdTCPClient1.IOHandler.Write(AStream);
mClientLog.Lines.Add('Sent file "' + ExtractFilename
(OpenDialog1.Filename) + '"');
finally
FreeAndNil(AStream);
end;
end;
end;
Server
Delphi-Quellcode:
var
s: string;
AStream: TFileStream;
Filename: string;
FileSize: Int64;
begin
while AContext.Connection.Connected do
begin
s := AContext.Connection.IOHandler.ReadLn;
if s = 'FILE' then
begin
Filename := AContext.Connection.IOHandler.ReadLn; // get filename
FileSize := StrToInt(AContext.Connection.IOHandler.ReadLn);
// get filesize
ForceDirectories(ExtractFilePath(Paramstr(0)) + 'In');
AStream := TFileStream.Create(ExtractFilePath(Paramstr(0))
+ 'In\' + Filename, fmCreate);
try
mServerLog.Lines.Add(AContext.Connection.Socket.Binding.PeerIP +
':Receiving file "' + Filename + '" ' + IntToStr(FileSize)
+ ' bytes');
AContext.Connection.IOHandler.RecvBufferSize:= 32768;
AContext.Connection.IOHandler.ReadStream(AStream, FileSize, False);
mServerLog.Lines.Add(AContext.Connection.Socket.Binding.PeerIP +
':Received file "' + Filename + '"');
finally
FreeAndNil(AStream);
end;
end
else if s = 'QUIT' then
begin
mServerLog.Lines.Add(AContext.Connection.Socket.Binding.PeerIP + ':QUIT');
AContext.Connection.Disconnect;
end
else
begin
mServerLog.Lines.Add(AContext.Connection.Socket.Binding.PeerIP +
':UNKNOWN COMMAND: ' + s);
AContext.Connection.Disconnect;
end;
end;
end;
Gibt es da eine grenze bei
Indy und Dateigröße oder bin ich einfach nur zu blöd
Gruß