Autor Beitrag
FrEaKY
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 235


D7
BeitragVerfasst: So 06.01.08 03:22 
Es geht mir hierbei nicht um die Übertragungsrate selbst, sondern um die Prozeduren in denen man diese berechnen kann. Beim idTCPClient gibts ja dafür BeginWork und DoWork usw. Jedoch beim Server sind sie nurnoch als Funktionen vorhanden und nicht mehr im Objektfenster. Aber ich will die Geschwindigkeit ja beim Server wissen und nich beim Client.

Wie kann ich diese Funktionen irgendwie auf eigene Funktionen "umleiten", damit ich das dort ausrechnen kann?

Moderiert von user profile iconTino: Überflüssige Zeilenumbrüche entfernt.
FrEaKY Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 235


D7
BeitragVerfasst: Di 08.01.08 11:06 
weiß es keiner?
hazard999
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 162

Win XP SP2
VS 2010 Ultimate, CC.Net, Unity, Pex, Moles, DevExpress eXpress App
BeitragVerfasst: Di 08.01.08 12:16 
Hallo,

eigene Klasse von TIDTcpServer ableiten.

Funktionen verdecken.

im Funktionscode dann inherited aufrufen

eigenen Code dazu implementieren.

Wenn dir das jetzt nichts sagt: OOP-Tutorial lesen.

r u

René

_________________
MOV EAX, Result;MOV BYTE PTR [EAX], $B9;MOV ECX, M.Data;MOV DWORD PTR [EAX+$1], ECX;MOV BYTE PTR [EAX+$5], $5A;MOV BYTE PTR [EAX+$6], $51;MOV BYTE PTR [EAX+$7], $52;MOV BYTE PTR [EAX+$8], $B9;MOV ECX, M.Code;MOV DWORD PTR [EAX+$9], ECX
FrEaKY Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 235


D7
BeitragVerfasst: Mi 09.01.08 11:01 
Kannst du mir nen Link geben oder so? Hier in den Tutorials hab ichs net gefunden.
hazard999
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 162

Win XP SP2
VS 2010 Ultimate, CC.Net, Unity, Pex, Moles, DevExpress eXpress App
BeitragVerfasst: Mi 09.01.08 11:24 
das sollte helfen:

www.delphi-library.d...mp;highlight=klassen

r u

René

_________________
MOV EAX, Result;MOV BYTE PTR [EAX], $B9;MOV ECX, M.Data;MOV DWORD PTR [EAX+$1], ECX;MOV BYTE PTR [EAX+$5], $5A;MOV BYTE PTR [EAX+$6], $51;MOV BYTE PTR [EAX+$7], $52;MOV BYTE PTR [EAX+$8], $B9;MOV ECX, M.Code;MOV DWORD PTR [EAX+$9], ECX
FrEaKY Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 235


D7
BeitragVerfasst: Do 10.01.08 08:01 
Hm ich kriegs net so richtig hin, kannste vllt nen Beispiel posten?
FrEaKY Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 235


D7
BeitragVerfasst: Mo 04.02.08 15:52 
Wäre nett wenn jemand ne kleine Anleitung geben könnte.

Ich hhabs jetzt so aber es funzt nicht:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
  
ser = class(TIdTCPSErver)
  public
    [...] 
    procedure serWorkBegin(Sender: TObject; AWorkMode: TWorkMode;
        const AWorkCountMax: Integer);
  end;

[...]

procedure ser.serWorkBegin(Sender: TObject; AWorkMode: TWorkMode;
  const AWorkCountMax: Integer);
begin
   inherited;
   showmessage('blah');
   form1.label3.caption := inttostr((aworkcountmax div 1024))+ ' K';
   form1.progressbar1.Max := aworkcountmax;
end;


Die Showmessage wird noch nichtmal aufgerufen...
MarkusD
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 22



BeitragVerfasst: Mo 04.02.08 16:45 
Hallo,

ich weiß jetzt zwar nicht, wie die Methode beim TIDTcpServer heißt, aber du sollst keine eigene procedure erstellen, sondern die alte überschreiben.
Ich nehme jetzt einfach mal an, dass die Methode in Indy "WorkBegin" heißt. Dann müsstest du folgendes machen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
ser = class(TIdTCPSErver)
  public
    [...] 
    procedure WorkBegin(Sender: TObject; AWorkMode: TWorkMode;
        const AWorkCountMax: Integer); override;
  end;


Markus
hazard999
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 162

Win XP SP2
VS 2010 Ultimate, CC.Net, Unity, Pex, Moles, DevExpress eXpress App
BeitragVerfasst: Mo 04.02.08 16:52 
Exakt.

Markus war schneller ^_°

_________________
MOV EAX, Result;MOV BYTE PTR [EAX], $B9;MOV ECX, M.Data;MOV DWORD PTR [EAX+$1], ECX;MOV BYTE PTR [EAX+$5], $5A;MOV BYTE PTR [EAX+$6], $51;MOV BYTE PTR [EAX+$7], $52;MOV BYTE PTR [EAX+$8], $B9;MOV ECX, M.Code;MOV DWORD PTR [EAX+$9], ECX
FrEaKY Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 235


D7
BeitragVerfasst: Sa 16.02.08 18:35 
Es funzt leider immernoch nicht. Ich komm einfach nich dahinter warum...
habs jetzt so:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
  ser = class(TIdTCPSErver)
  public
    procedure serConnect(AThread: TIdPeerThread);
    procedure serExecute(AThread: TIdPeerThread);
    procedure serDisconnect(AThread: TIdPeerThread);
    procedure BeginWork( AWorkMode: TWorkMode;
        const AWorkCountMax: Integer); override;
  end;


procedure ser.BeginWork( AWorkMode: TWorkMode;
  const AWorkCountMax: Integer);
begin
   inherited;
   showmessage('asf');
   form1.label3.caption := inttostr((aworkcountmax div 1024))+ ' K';
   form1.progressbar1.Max := aworkcountmax;
end;


:cry:
FrEaKY Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 235


D7
BeitragVerfasst: Mi 05.03.08 18:47 
PLEASE HELP!! :cry: :cry: :cry:
artelogic
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39



BeitragVerfasst: Fr 07.03.08 02:10 
das funzt nicht, weil das so nicht geht. die sache ist im server etwas verstrickter. das geht damit los, daß der multi-threaded ist und endet nicht damit, daß der einen anderen iosockethandler verwendet.

was soll das denn überhaupt werden? also warum willst du am server messen? oder um es mal genau unter die lupe zu nehmen, kannst du ja gar nicht an nur einem punkt messen. der server haut die daten ggf. in wenigen millisekunden raus, wann die aber komplett an der gegenstelle eingetroffen sind, läßt sich ja server-seitig ohne weiteres überhaupt nicht feststellen.
Quitzlinga
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 60
Erhaltene Danke: 2

Win XP
Delphi 2007 Prof. Codegear Win32
BeitragVerfasst: Fr 07.03.08 11:20 
Es sei denn, man verlangt vom Client eine Antwort, das die Daten eingetroffen sind, womit man wieder bei der Implementierung eines Protokolls ist.
FrEaKY Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 235


D7
BeitragVerfasst: Do 13.03.08 10:08 
Nene, also zu erfahren wann die Daten angekommen sind darum gehts mir garnicht.
Sondern ich will in der DoWork procedure die GEschwindigkeit messen. Aber wenn ich die so mache wie im Beispiel wird sie ja nichmal aufgerufen... :/
Das muss doch irgendwie gehen :S
artelogic
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39



BeitragVerfasst: Fr 14.03.08 20:33 
Wie sieht denn der Write aus? Bisschen Source bitte!
FrEaKY Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 235


D7
BeitragVerfasst: Fr 14.03.08 20:45 
Senden (beim client):
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
procedure TForm1.Button3Click(Sender: TObject);
var
    fs : tfilestream;
begin
    fs := Tfilestream.Create('lmao.mp3', fmOpenRead or fmShareDenyWrite);
    try
        cli.Connect(10);
        cli.OpenWriteBuffer(fs.Size);
        cli.WriteStream(fs, true, false, fs.Size);
        cli.ClearWriteBuffer;
        cli.CloseWriteBuffer;
        cli.Disconnect;
    finally
        fs.Free;
    end;
end;



Empfangen (beim server):

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure ser.serExecute(AThread: TIdPeerThread);
var
    ts : tfilestream;
begin
    ts := Tfilestream.Create('lmao2transferred.mp3', fmCreate);
    athread.Connection.RecvBufferSize := 32768;
    try
        athread.Connection.OpenWriteBuffer(ts.Size);
        athread.Connection.ReadStream(ts,-1, true);
        athread.Connection.ClearWriteBuffer;
        athread.Connection.CloseWriteBuffer;
    finally
        ts.Free;
    end;
end;



Naja und für die Fortschrittsanzeige
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
procedure ser.serWork(Sender: TObject; AWorkMode: TWorkMode;
  const AWorkCount: Integer);
begin
    inherited;
    form1.progressbar1.Position := aworkcount;
end;


procedure ser.BeginWork( AWorkMode: TWorkMode;
  const AWorkCountMax: Integer);
begin
   inherited;
   showmessage('lol');
   form1.label3.caption := inttostr((aworkcountmax div 1024))+ ' K';
   form1.progressbar1.Max := aworkcountmax;
end;

<- Der teil geht halt nicht, also wird nicht aufgerufen... Warum!! Was ist da falsch=?
artelogic
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39



BeitragVerfasst: Fr 14.03.08 21:06 
kurze zwischenfrage: welche indy version? wenn 10, dann bitte genau. wenn 9, bin ich eh raus... ;)
FrEaKY Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 235


D7
BeitragVerfasst: Fr 14.03.08 21:15 
keine Ahnung ehrlich gesagt :?

ich hab die ganz normalen die bei Delphi 7 Enterprise dabei waren.
artelogic
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39



BeitragVerfasst: Fr 14.03.08 21:29 
na gut, sei es mal drum. ;)

das läuft ja wahrscheinlich beides (server und client) auf einem computer, wenn nicht sogar in einem project. kannste das mal andersrum machen, also server schreibt und client ließt?
FrEaKY Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 235


D7
BeitragVerfasst: Fr 14.03.08 21:36 
hmmm andersrum hatte ich es schon vorher :P aber hab dann aus einigen gründen geändert, u.a weil es so für mich einfacher ist vom server aus die übertragungen entgegenzunehmen.

Aber es ging ja als ichs genau anders rum hatte auch schon nicht also daran kann es nicht liegen!
:?