Autor Beitrag
noNeed 4 aNick
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20



BeitragVerfasst: So 11.12.05 22:49 
Nabend zusammen,

ich hab hier folgenden Code:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TConnectionForm.Button2Click(Sender: TObject);
var fs: TFileStream;
begin
        fs := TFileStream.Create(inFileName.Text, fmOpenRead + fmShareExclusive);
        
        Socket.SendStream(fs);

        fs.Free;
end;


Nun stürzt das Programm immer bei fs.Free ab, mit ner wilden Fehlermeldung...
Wenn ich das fs.Free weglasse, funzt es wunderbar. Aber irgendwie erscheint mir das als nicht gut :)

Also was mach ich falsch?

Thx In Advance
Alex
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: So 11.12.05 22:57 
Was meldet er dir denn? eine AccessViolation?

_________________
Programmers never die, they just GOSUB without RETURN
noNeed 4 aNick Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20



BeitragVerfasst: So 11.12.05 23:02 
Ne EAccessViolation:
Zitat:

'Zugriffsverletzung bei Adresse 00000000. Lesen von Adresse 00000000'
Muetze1
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 346



BeitragVerfasst: So 11.12.05 23:03 
Ok, dann schau nochmal in die Hilfe und lies dir mal durch was dort zu SendStream() steht: Der Stream wird von SendStream() freigegeben, wenn er komplett gesendet wurde. SendStream() sendet die Daten asynchron im Hintergrund. Mit anderen Worten: wenn SendStream() wieder zurückkehrt vom Aufruf bedeutet das nicht mal ansatzweise, das auch der komplette Streaminhalt versendet wurde.

_________________
49 63 68 68 61 62 65 6B 65 69 6E 65 41 68 6E 75 6E 67 21