Autor Beitrag
hibbert
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1007

WinServer2003, Win XP, Linux
D6 Pers, D05
BeitragVerfasst: Di 14.02.06 21:27 
Hi,
da bin ich wieder, und noch immer habe ich Probleme mit Indy10 :cry:
Ich habe bereits gefragt, wie ich mit Indy10 Dateien Senden kann, weil es anders ist als bei Indy9.

Nun ist leider auch das Empfangen der Dateien mit Indy10 anders als mit Indy9 :cry:
Mit Indy9 geht es so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure TForm1.IdTCPServer1Execute(AThread: TIdPeerThread);
var
  fs: TFileStream;
  SizeOfIncomingStream: integer;
begin
  fs := TFileStream.Create('datei.endung', fmCreate or fmShareExclusive);
  with AThread.Connection do
    try
      SizeOfIncomingStream := ReadInteger; //Größe des Streams empfangen
      ReadStream(fs, SizeOfIncomingStream); //und übergeben
    finally
      // Disconnect;
      fs.Free;
    end;
end;


Ich habe schon heruasgefunden, dass man idcontext mit in die Uses-Klausel aufnehmen muss, doch jetzt stecke ich fest:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure TForm1.IdTCPServer1Execute(AContext: TIdContext);
var
  fs: TFileStream;
  SizeOfIncomingStream: integer;
begin
  fs := TFileStream.Create('friend.jpg', fmCreate or fmShareExclusive);
  with AContext.Connection do
    try
      SizeOfIncomingStream := IOHandler.ReadInteger; //Größe des Streams empfangen
      IOHandler.ReadStream(fs, SizeOfIncomingStream); //und übergeben
    finally
      // Disconnect;
      fs.Free;
    end;
end;


Kann mir da evtl einer weiterhelfen ?

thx hibbert

_________________
I kunnen väl svara endast ja eller nej
Om i viljen eller nej
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Di 14.02.06 23:51 
Scheint wieder wie bei dem anderen Thema zu sein, Du brauchst einen TIdStreamVCL:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
procedure TForm1.IdTCPServer1Execute(AContext: TIdContext);
var
  fs: TFileStream;
  stream: TIdStreamVCL;
  SizeOfIncomingStream: integer;
begin
  fs := TFileStream.Create('friend.jpg', fmCreate or fmShareExclusive);
  stream := TIdStreamVCL.Create(fs);
  with AContext.Connection do
    try
      SizeOfIncomingStream := IOHandler.ReadInteger; //Größe des Streams empfangen
      IOHandler.ReadStream(stream, SizeOfIncomingStream); //und übergeben
    finally
      // Disconnect;
      fs.Free;
    end;
end;

Würd gern wissen, obs funktioniert hat, weil ich hab noch nie Dateien mit Indy verschickt *g*.
hibbert Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1007

WinServer2003, Win XP, Linux
D6 Pers, D05
BeitragVerfasst: Mi 15.02.06 23:59 
Danke, ich werd es mal versuchen... und berichten was passiert is :wink:

_________________
I kunnen väl svara endast ja eller nej
Om i viljen eller nej
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Do 16.02.06 00:07 
Schau mal unter Tools -> Umgebungsoptionen -> Bibliothek ob der Pfad zu Deiner Installation in einem der Pfade (am besten Bibliothekspfad) drinsteht. Wenn nicht, dann füge ihn hinzu und probiers nochmal.

BTW: Ich versuche solche Installer für Komponenten genau aus solchen Gründen zu vermeiden. Von Hand funktioniert dann doch meistens besser ;-)
hibbert Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1007

WinServer2003, Win XP, Linux
D6 Pers, D05
BeitragVerfasst: Do 16.02.06 00:11 
jupp :wink:

ich habe das prob gelöst, indem ich den Installer nochmal ausgeführt habe und ein anderes Verzeichnis angegeben habe, funktioniert diesmal allerdings :D

Also ich bin dann mal testen... :)

_________________
I kunnen väl svara endast ja eller nej
Om i viljen eller nej
hibbert Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1007

WinServer2003, Win XP, Linux
D6 Pers, D05
BeitragVerfasst: Do 16.02.06 00:18 
user profile iconhibbert hat folgendes geschrieben:
ich habe das prob gelöst, indem ich den Installer nochmal ausgeführt habe und ein anderes Verzeichnis angegeben habe, funktioniert diesmal allerdings :D

Verdammt, es funktioniert schon wieder nicht !! :evil:
Die Indy Komponenten in der Uses-Klausel werden unterstrichen, warum, diesmal hab ich nun wirklich nichts geändert...

hibbert

_________________
I kunnen väl svara endast ja eller nej
Om i viljen eller nej
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Do 16.02.06 00:32 
user profile iconhibbert hat folgendes geschrieben:
Verdammt, es funktioniert schon wieder nicht !! :evil:
Die Indy Komponenten in der Uses-Klausel werden unterstrichen, warum, diesmal hab ich nun wirklich nichts geändert...

Siehe meinen Tipp oben.
hibbert Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1007

WinServer2003, Win XP, Linux
D6 Pers, D05
BeitragVerfasst: Do 16.02.06 01:01 
Die waren vorher drin, dann hab ich Delphi geschlossen, dann ging es nicht mehr, und es lag wirklich daran, dass der Pfad nicht mehr eingetragen war komisch :?

Naja ich werde es dann morgen testen... (hoffentlich)

hibbert

_________________
I kunnen väl svara endast ja eller nej
Om i viljen eller nej
hibbert Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1007

WinServer2003, Win XP, Linux
D6 Pers, D05
BeitragVerfasst: Do 16.02.06 14:20 
Ich liebe es wenn man früher schluss bekommt, da konnte ich schon wunderbar testen und ich muss sagen, es funzt so wie es soll, die Testdatei kam vollständig an :D

thx hibbert

_________________
I kunnen väl svara endast ja eller nej
Om i viljen eller nej