Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   No puedo pasar un stream con los indy (https://www.clubdelphi.com/foros/showthread.php?t=40337)

mierda 13-02-2007 20:00:13

No puedo pasar un stream con los indy
 
Hola ... tengo el siguiente codigo, y no consigo pasar un stream por los indy ,.... me falta algo ... pero de aqui ya no se seguir

Código Delphi [-]
unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, IdThreadMgr, IdThreadMgrDefault, StdCtrls, IdTCPServer,
  IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, ExtCtrls;
type
  TForm1 = class(TForm)
    IdTCPClient1: TIdTCPClient;
    IdTCPServer1: TIdTCPServer;
    Button1: TButton;
    Memo1: TMemo;
    IdThreadMgrDefault1: TIdThreadMgrDefault;
    OpenDialog1: TOpenDialog;
    Memo2: TMemo;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure IdTCPServer1Execute(AThread: TIdPeerThread);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
  mistream: TMemoryStream;
begin
IdTCPServer1.Active := true;
IdTCPClient1.Connect();
mistream := TMemoryStream.Create;
Memo1.Lines.SaveToStream(mistream);
with IdTCPClient1 do
  begin
    WriteInteger(mistream.Size);
    OpenWriteBuffer;
    WriteStream(mistream); //then send the image
    CloseWriteBuffer;
  end;
  FreeAndNil(mistream);
end;
procedure TForm1.IdTCPServer1Execute(AThread: TIdPeerThread);
var
  ftmpStream : TmemoryStream;
  size : integer;
begin
ftmpStream := TMemoryStream.Create();
Size := AThread.Connection.ReadInteger;
AThread.Connection.ReadStream(fTmpStream,Size,False);
Memo2.Lines.LoadFromStream(ftmpStream);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if OpenDialog1.Execute then
  begin
    memo1.Lines.LoadFromFile(OpenDialog1.FileName);
  end;  
end;
end.

muchas gracias

egostar 13-02-2007 20:07:37

Perdon el atrevimiento pero parece que hoy estoy de lo mas simplon, al ver tu hilo en el indice del foro no pude reprimir la risa

Cita:



Y doble disculpa porque no puedo ayudarte a resolver tu problema.

Saludos.

Espero no te moleste.

mierda 14-02-2007 09:06:23

No hombre ....
 
No hombre ... no pasa nada :D


La franja horaria es GMT +2. Ahora son las 00:47:59.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi