Einzelnen Beitrag anzeigen

Benutzerbild von christian.noeding
christian.noeding

Registriert seit: 26. Mai 2005
Ort: Knw.-Remsfeld
119 Beiträge
 
Delphi XE2 Professional
 
#6

Re: Problem bei Ableitung von TIdTCPClient (Override von Cre

  Alt 9. Dez 2008, 12:30
Danke für den Tipp, aber es kommt der gleiche Fehler "Statische Methode kann nicht überschrieben werden".

Kann es daran liegen, dass IdTCPClientCustom die Funktionen z.T. überlädt? Zudem werden die Funktionen "Create" und "Disconnect" offensichtlich durch TIdTCPConnection geerbt. Somit müsste ich ja grundlegende Funktionen der Indys anpassen... Siehe hier:

Delphi-Quellcode:
  TIdTCPClientCustom = class(TIdTCPConnection)
  protected
    FBoundIP: String;
    FBoundPort: Integer;
    FBoundPortMax: Integer;
    FBoundPortMin: Integer;
    FConnectTimeout: Integer;
    FDestination: string;
    FHost: string;
    FIPVersion: TIdIPVersion;
    FOnConnected: TIdNotifyEvent;
    FPassword: string;
    FPort: TIdPort;
    FReadTimeout: Integer;
    FUsername: string;
    //
    FOnBeforeBind: TIdNotifyEvent;
    FOnAfterBind: TIdNotifyEvent;
    //
    procedure DoOnConnected; virtual;
    function MakeImplicitClientHandler: TIdIOHandler; virtual;
    //
    procedure SetConnectTimeout(const AValue: Integer);
    procedure SetReadTimeout(const AValue: Integer);
    procedure SetBoundIP(const AValue: String);
    procedure SetBoundPort(const AValue: Integer);
    procedure SetBoundPortMax(const AValue: Integer);
    procedure SetBoundPortMin(const AValue: Integer);
    procedure SetHost(const AValue: string); virtual;
    procedure SetPort(const AValue: TIdPort); virtual;
    procedure SetIPVersion(const AValue: TIdIPVersion); virtual;
    //
    procedure SetOnBeforeBind(const AValue: TIdNotifyEvent);
    procedure SetOnAfterBind(const AValue: TIdNotifyEvent);
    //
    procedure SetIOHandler(AValue: TIdIOHandler); override;
    procedure InitComponent; override;
    //
    function GetReadTimeout: Integer;
    //
    property Host: string read FHost write SetHost;
    property IPVersion: TIdIPVersion read FIPVersion write SetIPVersion;
    property Password: string read FPassword write FPassword;
    property Port: TIdPort read FPort write SetPort;
    property Username: string read FUsername write FUsername;
    //
    property OnConnected: TIdNotifyEvent read FOnConnected write FOnConnected;
  public
    procedure Connect; overload; virtual;
    // This is overridden and not as default params so that descendants
    // do not have to worry about the arguments.
    // Also has been split further to allow usage from C# as it does not have optional
    // params
    procedure Connect(const AHost: string); overload;
    procedure Connect(const AHost: string; const APort: Integer); overload;
    function ConnectAndGetAll: string; virtual;

    property BoundIP: string read FBoundIP write SetBoundIP;
    property BoundPort: Integer read FBoundPort write SetBoundPort default 0;
    property BoundPortMax: Integer read FBoundPortMax write SetBoundPortMax;
    property BoundPortMin: Integer read FBoundPortMin write SetBoundPortMin;

    property ConnectTimeout: Integer read FConnectTimeout write SetConnectTimeout;
    property ReadTimeout: Integer read GetReadTimeout write SetReadTimeout;
    property OnBeforeBind:TIdNotifyEvent read FOnBeforeBind write SetOnBeforeBind;
    property OnAfterBind:TIdNotifyEvent read FOnAfterBind write SetOnAfterBind;

  published
  end;
Christian Nöding
  Mit Zitat antworten Zitat