Indy 9 | Content | Index | Reference

TIdComponent
Hierarchy, Properties, Methods, Events, See Also, Unit: IdComponent
Ancestor of all Indy client and server components.

    TIdComponent = class(TIdBaseComponent)

Unit
IdComponent
Description
TIdComponent is the ancestor of all Indy components which implement client or server functionality. TIdComponent implements properties used to identify the host name for the local computer system, and event handlers used to signal state change, input, and output operations using the component.

TIdComponent.LocalName
TIdComponent, See Also, Example
Name of the local computer.

    property LocalName: string;

Description
LocalName is a read-only String property that contains the host name of the user's computer system.

LocalName uses the TIdStack instance variable GStack to access the WSHetHostName method in retrieving the LocalName value.

TIdComponent.BeginWork
TIdComponent
Used to trigger the OnBeginWork event.

    procedure BeginWork(AWorkMode: TWorkMode; const ASize: Integer = 0); virtual;

Parameters
AWorkMode: TWorkMode
Work mode for the peer connection.
const ASize: Integer = 0
Number of bytes to be read or written.
Description
BeginWork is a procedure used to trigger the OnBeginWork event. BeginWork maintains the number of reads and writes pending, and size information for the initial read and write operation.

AWorkMode is a TWorkMode enumerated type, and can contain the values:

- wmRead - The component is reading data from the peer.

- wmWrite - The component is sending data to the peer.

ASize is the optional value indicating the number of bytes expected by to be received or sent by the connection.

Calls to the BeginWork procedure can be nested, but the OnBeginWork event handler will be invoked only for the initial call to BeginWork.

Applications must assign a procedure to the OnBeginWork event handler in order to respond to the event notification.

TIdComponent.Create
TIdComponent, See Also
Constructor for the object instance.

    constructor Create(axOwner: TComponent); override;

Parameters
axOwner: TComponent
Component that owns the object instance.
Description
Create is the constructor of the object instance, and relies on the inherited Create constructor.

Create updates the variable GStack by creating a TIdStack instance, if one has not already been assigned, and increments a global instance count variable prior to completion of the constructor. Create uses a TCriticalSection to protect access to the GStack instance, which is released prior to exiting the method.

TIdComponent.Destroy
TIdComponent
Destructor for the object instance.

    destructor Destroy; override;

Description
Destroy is the destructor for the object instance.

Destroy is responsible for decrementing the value of gnInstanceCount prior to completion of the destructor. When gnInstanceCount reaches 0, the TIdStack instance in GStack is Freed and set to Nil.

Applications should not call the Destroy method, but use Free instead.

TIdComponent.DoWork
TIdComponent
Triggers the OnWork event handler.

    procedure DoWork(AWorkMode: TWorkMode; const ACount: Integer); virtual;

Parameters
AWorkMode: TWorkMode
Work mode for the peer connection.
const ACount: Integer
Number of bytes to be handled.
Description
DoWork is a procedure used to trigger the OnWork event handler. DoWork is used to signal that the indicated work mode will be used to handle the specified number of bytes.

AWorkMode is a TWorkMode enumerated type, and can contain the values:

- wmRead - The component is reading data from the peer.

- wmWrite - The component is sending data to the peer.

ACount is the number of bytes to be affected by the AWorkMode operation.

DoWork allows the application to respond to calls to the BeginWork method, and maintains the number of bytes available to be process in the OnWork event handler. DoWork will not have any effect unless BeginWork is called prior to calling DoWork.

The Application must assign a procedure to the OnWork event handler in order to respond to the event notification.

TIdComponent.EndWork
TIdComponent
Triggers the OnEndWork event handler.

    procedure EndWork(AWorkMode: TWorkMode); virtual;

Parameters
AWorkMode: TWorkMode
Work mode for the peer connection.
Description
EndWork is a procedure used to trigger the OnEndWork eventhandler. EndWork maintains the number of reads and writes pending, and size information for the initial read and write operations.

AWorkMode is a TWorkMode enumerated type, and can contain the values:

- wmRead - The component is reading data from the peer.

- wmWrite - The component is sending data to the peer.

Calls to the EndWork procedure can be nested, but the OnEndWork event handler will be invoked only for the initial call to EndWork.

Applications must assign a procedure to the OnEndWork event handler in order to respond to the event notification.

TIdComponent.OnStatus
TIdComponent
Represents the current connection status event handler.

    property OnStatus: TIdStatusEvent;

Parameters
aaArgs
Format arguments used to construct the current status text message.
axStatus
The current connection status.
Description
OnStatus is the TIdStatusEvent event handler triggered when the current connection state is changed. OnStatus is triggered by the DoStatus method, which provides the parameters used by the event handler.

axStatus is the TIdStatus value for the current connection.

aaArgs is the optional arguments for the Format function, that will be used to construct the text message that represents the current connection state.

Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.