• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1878
  • Last Modified:

Transfer Files

Hello,
whats the best way to transfer files between 2 Delphi programs? (server and client)?
Im using TCPServer & TCPClient...
Thank you
0
peritoX
Asked:
peritoX
  • 5
  • 3
  • 2
  • +2
1 Solution
 
calinutzCommented:
Transfer files...
You could upload the files to a webserver or a ftp server and download them on the other side.
What exactly do you mean by transfer files between 2 delphi applications..?
Give us more details about your applications.
Regards
0
 
wildzeroCommented:
I think there is a demo of these components in the Borland/Demos folder.... :D
0
 
peritoXAuthor Commented:
In VB its like this
http://www.winsockvb.com/article.php?article_id=37

but I want to do it in Delphi...

I think its
Read a file as binary
Send Chunks of binary data to other computer

Other PC, read the sent data and save as binary!

Please Help

Points Raised!
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
MainiacfreakusCommented:
I can do a demo 4 u...

What do u want me to use?
I can do Indy well.. but if u want something else, i am willing to try.

Mainiacfreakus
0
 
peritoXAuthor Commented:
TCPServer & TCPClient... arent they Indy Components.
Please Try doing a demo, (make sure it can send any size files)
thank you
0
 
MainiacfreakusCommented:
What are those components then?

(Will attempt as soon as I know which components to use)

Mainiacfreakus
0
 
TheRealLokiSenior DeveloperCommented:
Looks like you want to use Indy, so here's an example I wrote
Normally, you'd just use an FTP server/client, but if you want to make your own, then this method should be easy to implement in your code.
It uses a command "FILE" so you can add other commands if you like.

You must have indy 10 installed



unit Unit1;

interface
{
    Loki's Demo File sender/receiver - using Indy 10
    January 2006
    David Hooper (lokiwashere@yahoo.co.nz)
    All bugs reserved
}

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Buttons, ComCtrls, FileCtrl, IdAntiFreezeBase, IdAntiFreeze,
  IdTCPConnection, IdTCPClient, IdBaseComponent, IdComponent, IdTCPServer,
  IdContext, IDStreamVCL;

type
  TForm1 = class(TForm)
    IdTCPServer1: TIdTCPServer;
    IdTCPClient1: TIdTCPClient;
    IdAntiFreeze1: TIdAntiFreeze;
    gbServer: TGroupBox;
    rbServer: TRadioButton;
    rbClient: TRadioButton;
    bbStartServer: TBitBtn;
    bbStopServer: TBitBtn;
    mServerLog: TMemo;
    gbClient: TGroupBox;
    bbConnectClient: TBitBtn;
    bbDisconnectClient: TBitBtn;
    mClientLog: TMemo;
    bbSendFile: TBitBtn;
    OpenDialog1: TOpenDialog;
    ProgressBar1: TProgressBar;
    procedure bbStartServerClick(Sender: TObject);
    procedure rbServer_Or_Client_Click(Sender: TObject);
    procedure bbStopServerClick(Sender: TObject);
    procedure bbConnectClientClick(Sender: TObject);
    procedure bbDisconnectClientClick(Sender: TObject);
    procedure IdTCPServer1Status(ASender: TObject;
      const AStatus: TIdStatus; const AStatusText: String);
    procedure IdTCPClient1Status(ASender: TObject;
      const AStatus: TIdStatus; const AStatusText: String);
    procedure IdTCPServer1AfterBind(Sender: TObject);
    procedure IdTCPServer1Connect(AContext: TIdContext);
    procedure IdTCPServer1Disconnect(AContext: TIdContext);
    procedure bbSendFileClick(Sender: TObject);
    procedure IdTCPClient1WorkBegin(ASender: TObject; AWorkMode: TWorkMode;
      AWorkCountMax: Integer);
    procedure IdTCPClient1Work(ASender: TObject; AWorkMode: TWorkMode;
      AWorkCount: Integer);
    procedure IdTCPClient1WorkEnd(ASender: TObject; AWorkMode: TWorkMode);
    procedure IdTCPServer1Execute(AContext: TIdContext);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

IMPLEMENTATION

{$R *.DFM}

procedure TForm1.rbServer_Or_Client_Click(Sender: TObject);
    begin
// disconnect all
        IdTCPServer1.Active := False;
        if IdTCPClient1.Connected then
          IdTCPClient1.IOHandler.WriteLn('QUIT'); // send command "QUIT"
        gbServer.Enabled := rbServer.Checked;
        gbClient.Enabled := rbClient.Checked;
    end;

procedure TForm1.bbStartServerClick(Sender: TObject);
    begin
        IdTCPServer1.Active := True;
    end;

procedure TForm1.bbStopServerClick(Sender: TObject);
    begin
        IdTCPServer1.Active := False;
    end;

procedure TForm1.bbConnectClientClick(Sender: TObject);
    begin
        IdTCPClient1.Connect;
    end;

procedure TForm1.bbDisconnectClientClick(Sender: TObject);
    begin
        if IdTCPClient1.Connected then
          IdTCPClient1.IOHandler.WriteLn('QUIT'); // send command "QUIT"
// server will disconnect us
//        IdTCPClient1.Disconnect;
    end;

procedure TForm1.IdTCPServer1Status(ASender: TObject;
    const AStatus: TIdStatus; const AStatusText: String);
    begin
        mServerLog.Lines.Add(AStatusText);
    end;

procedure TForm1.IdTCPClient1Status(ASender: TObject;
    const AStatus: TIdStatus; const AStatusText: String);
    begin
        mClientLog.Lines.Add(AStatusText);
    end;

procedure TForm1.IdTCPServer1AfterBind(Sender: TObject);
    begin
        mServerLog.Lines.Add('Bound');
    end;

procedure TForm1.IdTCPServer1Connect(AContext: TIdContext);
    begin
        mServerLog.Lines.Add(AContext.Connection.Socket.Binding.PeerIP + ':Connected');
    end;

procedure TForm1.IdTCPServer1Disconnect(AContext: TIdContext);
    begin
        mServerLog.Lines.Add(AContext.Connection.Socket.Binding.PeerIP + ':Disconnected');
    end;

procedure TForm1.bbSendFileClick(Sender: TObject);
    var
        AStream: TIDStreamVCL;
    begin
        if OpenDialog1.Execute then
        begin
            AStream := TIDStreamVCL.Create(TFileStream.Create(OpenDialog1.Filename, fmOpenRead + fmShareDenyNone), True);
            try
                IdTCPClient1.IOHandler.WriteLn('FILE'); // send command "FILE"
                IdTCPClient1.IOHandler.WriteLn(ExtractFilename(OpenDialog1.Filename)); // send file name
                IdTCPClient1.IOHandler.WriteLn(IntToStr(AStream.VCLStream.Size)); // send file size
                mClientLog.Lines.Add('Sending file "' + ExtractFilename(OpenDialog1.Filename) + '"');
                ProgressBar1.Visible := True;
                IdTCPClient1.IOHandler.Write(AStream);
                mClientLog.Lines.Add('Sent file "' + ExtractFilename(OpenDialog1.Filename) + '"');
            finally
                FreeAndNil(AStream);
                ProgressBar1.Visible := False;
            end;
        end;
    end;

procedure TForm1.IdTCPClient1WorkBegin(ASender: TObject; AWorkMode: TWorkMode; AWorkCountMax: Integer);
    begin
        ProgressBar1.Max := AWorkCountMax;
        ProgressBar1.Position := 0;
    end;

procedure TForm1.IdTCPClient1Work(ASender: TObject; AWorkMode: TWorkMode; AWorkCount: Integer);
    begin
        if ProgressBar1.Visible then
          ProgressBar1.StepBy(AWorkCount);
    end;

procedure TForm1.IdTCPClient1WorkEnd(ASender: TObject; AWorkMode: TWorkMode);
    begin
        ProgressBar1.Position := 100;
        ProgressBar1.Visible := False;
    end;

procedure TForm1.IdTCPServer1Execute(AContext: TIdContext);
    var
        s: string;
        AStream: TIDStreamVCL;
        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 := TIDStreamVCL.Create(
                  TFileStream.Create(ExtractFilePath(Paramstr(0)) + 'In\' + Filename, fmCreate), True);
                try
                    mServerLog.Lines.Add(AContext.Connection.Socket.Binding.PeerIP + ':Receiving file "' + Filename + '" ' + IntToStr(Filesize) + ' bytes');
                    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;

end.



************************** FORM FOLLOWS ************************
************************** FORM FOLLOWS ************************

object Form1: TForm1
  Left = 274
  Top = 107
  Width = 629
  Height = 570
  Caption =
    'Loki'#39's demo file sender - run this app twice. once for server,on' +
    'ce or more for client(s)'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object gbServer: TGroupBox
    Left = 8
    Top = 32
    Width = 609
    Height = 241
    TabOrder = 0
    object bbStartServer: TBitBtn
      Left = 8
      Top = 16
      Width = 89
      Height = 25
      Caption = 'Start Server'
      TabOrder = 0
      OnClick = bbStartServerClick
    end
    object bbStopServer: TBitBtn
      Left = 104
      Top = 16
      Width = 89
      Height = 25
      Caption = 'Stop Server'
      TabOrder = 1
      OnClick = bbStopServerClick
    end
    object mServerLog: TMemo
      Left = 8
      Top = 48
      Width = 593
      Height = 185
      TabOrder = 2
    end
  end
  object rbServer: TRadioButton
    Left = 8
    Top = 16
    Width = 65
    Height = 17
    Caption = 'Server'
    Checked = True
    TabOrder = 1
    TabStop = True
    OnClick = rbServer_Or_Client_Click
  end
  object rbClient: TRadioButton
    Left = 8
    Top = 280
    Width = 57
    Height = 17
    Caption = 'Client'
    TabOrder = 2
    OnClick = rbServer_Or_Client_Click
  end
  object gbClient: TGroupBox
    Left = 8
    Top = 296
    Width = 609
    Height = 241
    Enabled = False
    TabOrder = 3
    object bbConnectClient: TBitBtn
      Left = 8
      Top = 16
      Width = 89
      Height = 25
      Caption = 'Connect'
      TabOrder = 0
      OnClick = bbConnectClientClick
    end
    object bbDisconnectClient: TBitBtn
      Left = 104
      Top = 16
      Width = 89
      Height = 25
      Caption = 'Disconnect'
      TabOrder = 1
      OnClick = bbDisconnectClientClick
    end
    object mClientLog: TMemo
      Left = 8
      Top = 48
      Width = 593
      Height = 161
      TabOrder = 2
    end
    object bbSendFile: TBitBtn
      Left = 208
      Top = 16
      Width = 89
      Height = 25
      Caption = 'Send File'
      TabOrder = 3
      OnClick = bbSendFileClick
    end
    object ProgressBar1: TProgressBar
      Left = 8
      Top = 216
      Width = 593
      Height = 16
      Min = 0
      Max = 100
      TabOrder = 4
    end
  end
  object IdTCPServer1: TIdTCPServer
    OnStatus = IdTCPServer1Status
    Bindings = <>
    DefaultPort = 9898
    OnAfterBind = IdTCPServer1AfterBind
    OnConnect = IdTCPServer1Connect
    OnExecute = IdTCPServer1Execute
    OnDisconnect = IdTCPServer1Disconnect
    Left = 72
    Top = 40
  end
  object IdTCPClient1: TIdTCPClient
    OnStatus = IdTCPClient1Status
    OnWork = IdTCPClient1Work
    OnWorkBegin = IdTCPClient1WorkBegin
    OnWorkEnd = IdTCPClient1WorkEnd
    ConnectTimeout = 0
    Host = '127.0.0.1'
    IPVersion = Id_IPv4
    Port = 9898
    ReadTimeout = 0
    Left = 104
    Top = 304
  end
  object IdAntiFreeze1: TIdAntiFreeze
    Left = 40
    Top = 304
  end
  object OpenDialog1: TOpenDialog
    Left = 40
    Top = 336
  end
end
0
 
peritoXAuthor Commented:
Thanks
Im having an error, I dont have IdContext & IDStreamVCL
I have Indy 9
where can I download Indy 10
Thank you

Did you test this code?
0
 
TheRealLokiSenior DeveloperCommented:
Yes i tested it, it is Indy 10, which is why you are having trouble.
It's available from http://www.projectindy.org
but to make the above code work with Indy 9, I think you just need to change a few things
Firstly, remove IdContext and IDStreamVCL from the uses clause.

Secondly, replace the bbSendFileClick code with

procedure TForm1.bbSendFileClick(Sender: TObject);
    var
        AStream: TFileStream;
    begin
        if OpenDialog1.Execute then
        begin
            AStream := TFileStream.Create(OpenDialog1.Filename, fmOpenRead + fmShareDenyNone);
            try
                IdTCPClient1.WriteLn('FILE'); // send command "FILE"
                IdTCPClient1.WriteLn(ExtractFilename(OpenDialog1.Filename)); // send file name
                IdTCPClient1.WriteLn(IntToStr(AStream.Size)); // send file size
                mClientLog.Lines.Add('Sending file "' + ExtractFilename(OpenDialog1.Filename) + '"');
                ProgressBar1.Visible := True;
                IdTCPClient1.Write(AStream);
                mClientLog.Lines.Add('Sent file "' + ExtractFilename(OpenDialog1.Filename) + '"');
            finally
                FreeAndNil(AStream);
                ProgressBar1.Visible := False;
            end;
        end;
    end;

and change the IdTCPServer1Execute to be

procedure TForm1.IdTCPServer1Execute(AContext: TIdContext);
    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.ReadLn; // get filename
                FileSize := StrToInt(AContext.Connection.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.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;

indy 9 had overloaded procedures for Read(), so you could go read(stream) or read(integer) I think.
also, indy 10 needs you to put IOHandler.Read... instead of just Read...

let me know if this works for indy 9, I only have 10 here, so can not test it
but the Indy 10 code works fine
It's just that switching from 9 to 10 is a BIG change, don't do it unless you want to rewrite all your existing Indy stuff
0
 
peritoXAuthor Commented:
Thanks, it had a lot of bugs specially changing AContext to AThread
but its still not working
in the following line:
IdTCPClient1.Write(AStream);

Im getting: Incompatible types: 'String' and 'TFileStream'

how to solve this?


here's the full code:

unit Unit1;

interface
{
    Loki's Demo File sender/receiver - using Indy 10
    January 2006
    David Hooper (lokiwashere@yahoo.co.nz)
    All bugs reserved
}

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Buttons, ComCtrls, FileCtrl, IdAntiFreezeBase, IdAntiFreeze,
  IdTCPConnection, IdTCPClient, IdBaseComponent, IdComponent, IdTCPServer
  ;

type
  TForm1 = class(TForm)
    IdTCPServer1: TIdTCPServer;
    IdTCPClient1: TIdTCPClient;
    IdAntiFreeze1: TIdAntiFreeze;
    gbServer: TGroupBox;
    rbServer: TRadioButton;
    rbClient: TRadioButton;
    bbStartServer: TBitBtn;
    bbStopServer: TBitBtn;
    mServerLog: TMemo;
    gbClient: TGroupBox;
    bbConnectClient: TBitBtn;
    bbDisconnectClient: TBitBtn;
    mClientLog: TMemo;
    bbSendFile: TBitBtn;
    OpenDialog1: TOpenDialog;
    ProgressBar1: TProgressBar;
    procedure bbStartServerClick(Sender: TObject);
    procedure rbServer_Or_Client_Click(Sender: TObject);
    procedure bbStopServerClick(Sender: TObject);
    procedure bbConnectClientClick(Sender: TObject);
    procedure bbDisconnectClientClick(Sender: TObject);
    procedure IdTCPServer1Status(ASender: TObject;
      const AStatus: TIdStatus; const AStatusText: String);
    procedure IdTCPClient1Status(ASender: TObject;
      const AStatus: TIdStatus; const AStatusText: String);
    procedure IdTCPServer1AfterBind(Sender: TObject);
    procedure IdTCPServer1Connect(AThread: TIdPeerThread);
    procedure IdTCPServer1Disconnect(AThread: TIdPeerThread);
    procedure bbSendFileClick(Sender: TObject);
    procedure IdTCPClient1WorkBegin(ASender: TObject; AWorkMode: TWorkMode;
      AWorkCountMax: Integer);
    procedure IdTCPClient1Work(ASender: TObject; AWorkMode: TWorkMode;
      AWorkCount: Integer);
    procedure IdTCPClient1WorkEnd(ASender: TObject; AWorkMode: TWorkMode);
    procedure IdTCPServer1Execute(AThread: TIdPeerThread);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

IMPLEMENTATION

{$R *.DFM}

procedure TForm1.rbServer_Or_Client_Click(Sender: TObject);
    begin
// disconnect all
        IdTCPServer1.Active := False;
        if IdTCPClient1.Connected then
          IdTCPClient1.WriteLn('QUIT'); // send command "QUIT"
        gbServer.Enabled := rbServer.Checked;
        gbClient.Enabled := rbClient.Checked;
    end;

procedure TForm1.bbStartServerClick(Sender: TObject);
    begin
        IdTCPServer1.Active := True;
    end;

procedure TForm1.bbStopServerClick(Sender: TObject);
    begin
        IdTCPServer1.Active := False;
    end;

procedure TForm1.bbConnectClientClick(Sender: TObject);
    begin
        IdTCPClient1.Connect;
    end;

procedure TForm1.bbDisconnectClientClick(Sender: TObject);
    begin
        if IdTCPClient1.Connected then
          IdTCPClient1.WriteLn('QUIT'); // send command "QUIT"
// server will disconnect us
//        IdTCPClient1.Disconnect;
    end;

procedure TForm1.IdTCPServer1Status(ASender: TObject;
    const AStatus: TIdStatus; const AStatusText: String);
    begin
        mServerLog.Lines.Add(AStatusText);
    end;

procedure TForm1.IdTCPClient1Status(ASender: TObject;
    const AStatus: TIdStatus; const AStatusText: String);
    begin
        mClientLog.Lines.Add(AStatusText);
    end;

procedure TForm1.IdTCPServer1AfterBind(Sender: TObject);
    begin
        mServerLog.Lines.Add('Bound');
    end;

procedure TForm1.IdTCPServer1Connect(AThread: TIdPeerThread);
    begin
        mServerLog.Lines.Add(AThread.Connection.Socket.Binding.PeerIP + ':Connected');
    end;

procedure TForm1.IdTCPServer1Disconnect(AThread: TIdPeerThread);
    begin
        mServerLog.Lines.Add(AThread.Connection.Socket.Binding.PeerIP + ':Disconnected');
    end;

procedure TForm1.bbSendFileClick(Sender: TObject);
    var
        AStream: TFileStream;
    begin
        if OpenDialog1.Execute then
        begin
            AStream := TFileStream.Create(OpenDialog1.Filename, fmOpenRead + fmShareDenyNone);
            try
                IdTCPClient1.WriteLn('FILE'); // send command "FILE"
                IdTCPClient1.WriteLn(ExtractFilename(OpenDialog1.Filename)); // send file name
                IdTCPClient1.WriteLn(IntToStr(AStream.Size)); // send file size
                mClientLog.Lines.Add('Sending file "' + ExtractFilename(OpenDialog1.Filename) + '"');
                ProgressBar1.Visible := True;
                IdTCPClient1.Write(AStream);
                mClientLog.Lines.Add('Sent file "' + ExtractFilename(OpenDialog1.Filename) + '"');
            finally
                FreeAndNil(AStream);
                ProgressBar1.Visible := False;
            end;
        end;
    end;


procedure TForm1.IdTCPClient1WorkBegin(ASender: TObject; AWorkMode: TWorkMode; AWorkCountMax: Integer);
    begin
        ProgressBar1.Max := AWorkCountMax;
        ProgressBar1.Position := 0;
    end;

procedure TForm1.IdTCPClient1Work(ASender: TObject; AWorkMode: TWorkMode; AWorkCount: Integer);
    begin
        if ProgressBar1.Visible then
          ProgressBar1.StepBy(AWorkCount);
    end;

procedure TForm1.IdTCPClient1WorkEnd(ASender: TObject; AWorkMode: TWorkMode);
    begin
        ProgressBar1.Position := 100;
        ProgressBar1.Visible := False;
    end;

procedure TForm1.IdTCPServer1Execute(AThread: TIdPeerThread);
    var
        s: string;
        AStream: TFileStream;
        Filename: string;
        FileSize: int64;
    begin
        while AThread.Connection.Connected do
        begin
            s := AThread.Connection.ReadLn;
            if S = 'FILE' then
            begin
                Filename := AThread.Connection.ReadLn; // get filename
                FileSize := StrToInt(AThread.Connection.ReadLn); // get filesize
                ForceDirectories(ExtractFilePath(Paramstr(0)) + 'In');
                AStream :=
                  TFileStream.Create(ExtractFilePath(Paramstr(0)) + 'In\' + Filename, fmCreate);
                try
                    mServerLog.Lines.Add(AThread.Connection.Socket.Binding.PeerIP + ':Receiving file "' + Filename + '" ' + IntToStr(Filesize) + ' bytes');
                    AThread.Connection.ReadStream(AStream, Filesize, False);
                    mServerLog.Lines.Add(AThread.Connection.Socket.Binding.PeerIP + ':Received file "' + Filename + '"');
                finally
                    FreeAndNil(AStream);
                end;
            end
            else if S = 'QUIT' then
            begin
                mServerLog.Lines.Add(AThread.Connection.Socket.Binding.PeerIP + ':QUIT');
                AThread.Connection.Disconnect;
            end
            else
            begin
                mServerLog.Lines.Add(AThread.Connection.Socket.Binding.PeerIP + ':UNKNOWN COMMAND: ' + S);
                AThread.Connection.Disconnect;
            end;
        end;
    end;


end.
0
 
peritoXAuthor Commented:
Omg, it worked
change
IdTCPClient1.Write(AStream);
to
IdTCPClient1.WriteStream(AStream);

thanks alot
0
 
TheRealLokiSenior DeveloperCommented:
heh great, not bugs :P just differences between indy 9 and indy 10. Have fun
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 5
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now