🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #5575

Re: Indy TIdFTPServer DefaultDataPort Problem

#5575
From: Remy Lebeau (TeamB)
Date: Wed, 14 Jul 2004 00:03
79 lines
3463 bytes
"Hugo Dias" <synchron@nospam.synchron-systems.com> wrote in message
news:40f44d50$1@newsgroups.borland.com...

> I now know that i can solve problem on the client.
>
> I need that the PORT command will be
> allways : x,x,x,x,207,19 (port 53011)
>
> To do this i've altered the Indy TIdSimpleServer.pas
> Source code to allways use this port.

A better solution would be to update TIdFTP to allow assigning custom values
to the TIdSimpleServer's Port property when issuing sPORT commands.
TIdSimpleServer is used in other places of Indy, so you should not mess with
it.  For example (untested):

    TIdFTP = class(TIdTCPClient)
    protected
        //...
        FDefaultDataPort: Integer;
        //...
    published
        //...
        property DefaultDataPort: Integer read FDefaultDataPort write
FDefaultDataPort default 0;
        //...
    end;

    constructor TIdFTP.Create(AOwner: TComponent);
    begin
        //...
        FDefaultDataPort := 0;
    end;

    procedure TIdFTP.InternalGet(const ACommand: string; ADest: TStream;
AResume: Boolean = false);
    begin
        //...
        FDataChannel := TIdSimpleServer.Create(nil); try
            with TIdSimpleServer(FDataChannel) do begin
                //...
                BoundIP := (Self.IOHandler as
TIdIOHandlerSocket).Binding.IP;
                BoundPort := Self.DefaultDataPort;    // <-- here
                BeginListen;
                //...
            end;
        //...
    end;

    procedure TIdFTP.InternalPut(const ACommand: string; ASource: TStream;
AFromBeginning: Boolean = true);
    begin
        //...
        FDataChannel := TIdSimpleServer.Create(nil); try
            with TIdSimpleServer(FDataChannel) do begin
                //...
                BoundIP := (Self.IOHandler as
TIdIOHandlerSocket).Binding.IP;
                BoundPort := Self.DefaultDataPort;    // <-- here
                BeginListen;
                //...
            end;
        //...
    end;

> I no this is not a good solution. If you have any idea
> how i can force the TIdFTP to use port 53011 without
> change Indy source i would apreciate.

Currently, it is not possible without changing Indy's source code.  However,
you simply chose the wrong place to modify, that's all.

Either way, that does not address the original problem that exists in
TIdFTPServer.  That will have to be fixed.


Gambit
Technical Details
Message-ID: <40f47842$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <40f3f2dc@newsgroups.borland.com> <40f42dbb$1@newsgroups.borland.com> <40f44d50$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,9479e70f708bd336
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <40f3f2dc@newsgroups.borland.com> <40f42dbb$1@newsgroups.borland.com> <40f44d50$1@newsgroups.borland.com>
Subject: Re: Indy TIdFTPServer DefaultDataPort Problem
Date: Tue, 13 Jul 2004 17:03:48 -0700
Lines: 81
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <40f47842$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1089763394 68.69.17.41 (13 Jul 2004 17:03:14 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail