Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Netzwerke (https://www.delphipraxis.net/14-netzwerke/)
-   -   Delphi IdSimpleServer: Wie Daten senden? (https://www.delphipraxis.net/28938-idsimpleserver-wie-daten-senden.html)

DevilsCamp 3. Sep 2004 07:15

Re: IdSimpleServer: Wie Daten senden?
 
Zitat:

Zitat von Dax
Du kannst stattdessen schreiben:
Delphi-Quellcode:
i := Length(AStatusMessage);
height := height - i;
Dann würde das gehen.

:( :( :(

Leider auch nicht.
Es sieht wohl so aus, als ob OnStatus von der Komponente nicht ausgelöst wird (ich benutzte Indy 9.0.14)

SirThornberry 3. Sep 2004 07:49

Re: IdSimpleServer: Wie Daten senden?
 
Schau mal ob es ein OnExecute gibt.

DevilsCamp 3. Sep 2004 08:11

Re: IdSimpleServer: Wie Daten senden?
 
Es gibt:

OnDisconnect
OnStatus
OnWork
OnWorkBegin
OnWorkEnd


Aber irgendwie reagiert der auf keinen der 5 Events...

Des Weiteren gibt es in der Event-Liste noch (in Rot geschrieben):
Intercept
IOHandler

Folgendes steht in der Indy-Hilfe über Intercept:
Zitat:

Allows intercept of read and write operations for the connection.

property Intercept: TIdConnectionIntercept;

Description

Intercept is a TIdConnectionIntercept property used to act as an intermediary between the protocol stack and a TIdTCPConnection. Intercept is used to perform operations that can include logging send and receive operations, or provide Secure Socket Layer (SSL) support for the connection.
The Intercept must be Enabled to allow Intercept actions to be performed.

Über IOHandler steht folgendes:
Zitat:

Provides an abstract input/output source for send and receive operations.

property IOHandler: TIdIOHandler;

Description

IOHandler is a TIdIOHandler property that indicates the class to be used to provide input and output sources for the connection. IOHandler, and descendant classes, allow abstraction of send and receive operations using Socket connections, streams, or any input/output source where an IOHandler has been written. The default IOHandler in Indy is the socket-based TIdIOHandlerSocket.

IOHandler is used in methods that perform low-level read or write operations like ReadFromStack and WriteBuffer. IOHandler is also used in methods that access the connection status like CheckForDisconnect, Connected, DisconnectSocket, and Disconnect.

When accessing IOHandler in application code, always cast the IOHandler to the correct descendant class. This is needed to access any methods or properties in the descendant that cannot be represented in the ancestor class at runtime.

Vielleicht hilft das weiter (mir irgendwie nicht, obwohl ich doch recht gut Englisch verstehe...)

Dax 3. Sep 2004 13:56

Re: IdSimpleServer: Wie Daten senden?
 
Vielleicht liegt hier der Fehler:

Delphi-Quellcode:
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
   if CheckBox1.Checked then
      IdSimpleServer1.Listen
   else
      IdSimpleServer1.EndListen;
end;
Versuch mal statt .Listen .BeginListen.

DevilsCamp 6. Sep 2004 11:48

Re: IdSimpleServer: Wie Daten senden?
 
hat erstens nicht funktioniert und zweitens bin ich nun auf IdTCPServer mit MaxConnections=1 umgestiegen.

quirks 6. Sep 2004 12:19

Re: IdSimpleServer: Wie Daten senden?
 
Bin grad in der Schule und deshalb ohne Indy, versuche aber trotzdem mal zu helfen.

Ich hab das immer so gemacht: Bei den Eigenschaften/Ereignissen des Servers gibt es ein OnExecute (oder ähnlich), das wird aufgerufen, wenn 1.) keine CommandHandler vorhanden sind oder 2.) CommandHandler deaktiviert werden. Im Normalzustand, also wenn du die Kompo gerade erst platziert hast, einfach eine Routine für On Exec. schreiben und fertig (einfacher gehts aber mit CommandHandlern)

DevilsCamp 6. Sep 2004 15:40

Re: IdSimpleServer: Wie Daten senden?
 
Auf die Idee wäre ich auch gekommen, wenn TIdSimpleServer ein OnExecute Event hätte ;)
Gibt es aber nicht.

Ich habe es jetzt aber auch geschafft die TIdTCPServer Komponente funktionierend in mein Programm einzubauen (bisher ist beim Versand von Dateien der Server einfach eingefroren, trotz TIdAntiFreeze)...

quirks 6. Sep 2004 16:20

Re: IdSimpleServer: Wie Daten senden?
 
OK, bin jetzt zu Hause und kann "interaktiv" Hilfe leisten :)

Hab meinen Fehler gefunden. :oops: Hast recht, IdSimpleServer hat kein OnExecute etc. :pale:

Hab an IdTCPServer (bzw. IdUDPServer) gedacht. Der ist zwar ein bisschen größer im Quälcode, ist aber SEHR viel einfacher zu handhaben. Mit OnConnect oder OnExecute oder ein paar CommandHandlern wird das bestimmt gehen.


Alle Zeitangaben in WEZ +1. Es ist jetzt 22:51 Uhr.
Seite 2 von 2     12   

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