Einzelnen Beitrag anzeigen

gandime
(Gast)

n/a Beiträge
 
#7

Re: indy tcp connection 1.uppt was 2. macht nichts warum?

  Alt 2. Sep 2006, 17:14
so
was soll ich daran debuggen? ich finde nichts!

client:
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
begin
  IdTCPClient_msg.Connect;
  IdTCPClient_send.Connect;
  ti_msg.enabled:=true;
end;

procedure TForm1.ti_msgTimer(Sender: TObject);
begin
  ti_send.enabled:=true;
  IdTCPClient_msg.socket.WriteLn('ja');
end;

procedure TForm1.ti_sendTimer(Sender: TObject);
var
  FStream: TFileStream;
begin
  ti_send.enabled:=false;
  FStream := TFileStream.Create('C:\b.avi', fmOpenRead);
  try
    IdTCPClient_msg.socket.WriteLn('jetzt');
    IdTCPClient_send.socket.Write(Fstream,0,true);
    IdTCPClient_msg.socket.WriteLn('ende');
  finally
    IdTCPClient_send.Disconnect;
  end;
  FreeAndNil(FStream);
  ti_msg.enabled:=false;
  ti_send.enabled:=false;
  IdTCPClient_msg.Disconnect;
end;
server:
Delphi-Quellcode:
procedure TForm1.IdTCPServer_getExecute(AContext: TIdContext);
var
  FStream:tfilestream;
begin
  FStream := TFileStream.Create('C:\ka.avi', fmCreate);
  try
    AContext.connection.socket.ReadStream(fstream);
  finally
  end;
  FreeAndNil(FStream);
end;

procedure TForm1.IdTCPServer_msgExecute(AContext: TIdContext);
begin
  try
    while (AContext.Connection.Connected=true) do
    begin
      memo1.Lines.add(AContext.Connection.socket.ReadLn);

    end;
  except

  end;
end;
  Mit Zitat antworten Zitat