AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Netzwerke Delphi indy10 / TCPServer /TCPClient ->Datei versenden
Thema durchsuchen
Ansicht
Themen-Optionen

indy10 / TCPServer /TCPClient ->Datei versenden

Ein Thema von cherry · begonnen am 3. Apr 2008 · letzter Beitrag vom 18. Apr 2008
 
Benutzerbild von cherry
cherry

Registriert seit: 14. Nov 2005
561 Beiträge
 
RAD-Studio 2009 Ent
 
#5

Re: indy10 / TCPServer /TCPClient ->Datei versenden

  Alt 3. Apr 2008, 08:52
daran liegts eben nicht. die Datei ist vorhanden und BDS findet sie auch. in den uses habe ich sie angegeben und dort wird sie auch erkannt! (nicht rot unterstrichen) aber es scheint, als sei dieser Typ (TIdStreamVCL) gar nicht vorhanden dort?!

Die Datei liegt in C:\Programme\BDS\4.0\Indy10\System

Der gesamte Inhalt der Datei:

Delphi-Quellcode:
{
  $Project$
  $Workfile$
  $Revision$
  $DateUTC$
  $Id$

  This file is part of the Indy (Internet Direct) project, and is offered
  under the dual-licensing agreement described on the Indy website.
  ([url]http://www.indyproject.org/[/url])

  Copyright:
  (c) 1993-2005, Chad Z. Hower and the Indy Pit Crew. All rights reserved.
}

{
  $Log$
}


unit IdStreamVCL;

interface
{$I IdCompilerDefines.inc}

uses
  Classes,
  IdGlobal;

type

  TIdStreamHelperVCL = class
  public
    class function ReadBytes(
          const AStream: TStream;
          var VBytes: TIdBytes;
          const ACount: Integer = -1;
          const AOffset: Integer = 0) : Integer; {$IFDEF DOTNET} static; {$ENDIF}
    class procedure Write(
          const AStream: TStream;
          const ABytes: TIdBytes;
          const ACount: Integer = -1); {$IFDEF DOTNET} static; {$ENDIF}
  end;

implementation

class function TIdStreamHelperVCL.ReadBytes(const AStream: TStream; var VBytes: TIdBytes;
  const ACount, AOffset: Integer): Integer;
var
 aActual:Integer;
begin
  Assert(AStream<>nil);
  Result:=0;

  if VBytes = nil then
  begin
    SetLength(VBytes, 0);
  end;
  //check that offset<length(buffer)? offset+count?
  //is there a need for this to be called with an offset into a nil buffer?

  aActual:=ACount;
  if aActual = -1 then begin
    aActual := AStream.Size - AStream.Position;
  end;

  //this prevents eg reading 0 bytes at Offset=10 from allocating memory
  if aActual=0 then begin
    Exit;
  end;

  if Length(VBytes) < (AOffset+aActual) then begin
    SetLength(VBytes, AOffset+aActual);
  end;

  Assert(VBytes<>nil);
  Result := AStream.Read(VBytes[AOffset], aActual);
end;

class procedure TIdStreamHelperVCL.Write(const AStream: TStream;const ABytes: TIdBytes;
  const ACount: Integer);
var
 aActual:Integer;
begin
  Assert(AStream<>nil);

  aActual:=ACount;
  //should we raise assert instead of this nil check?
  if ABytes <> nil then
  begin
    if aActual = -1 then
    begin
      aActual := Length(ABytes);
    end
    else
    begin
      aActual := Min(aActual, Length(ABytes));
    end;
    if aActual > 0 then
    begin
      AStream.Write(ABytes[0], aActual);
    end;
  end;
end;

end.
Da seh ich nichts von TIdStreamVCL!

Wenn ich diesen Typ: TIdStreamHelperVCL verwende, kann ich im Konstruktor aber keinen TFileStream angeben!

so sollte es sein:
TidStreamVCL.Create(FStream); das kann ich nur:
TidStreamHelperVCL.Create aber das bringt mir nichts!

Ideeen?
Ist das nur mein Gefühl, oder ist die ganze Welt verrückt geworden!?
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 18:34 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz