Topic Path: Symbol Reference > Classes > TIdComponent Class > TIdComponent Methods > BeginWork Method
ContentsIndexHome
PreviousUpNext
TIdComponent.BeginWork Method

Triggers the OnBeginWork event.

procedure BeginWork(
    AWorkMode: TWorkMode; 
    const ASize: Int64 = 0
); virtual;
Parameters 
Description 
AWorkMode 
Work mode for the peer connection.
 
ASize 
Number of bytes to be read or written. Default value is 0. 

BeginWork is a virtual procedure used to trigger the OnBeginWork event. BeginWork maintains the number of reads and writes pending. BeginWork also maintains the size of the initial read and/or write request when the Size is known at the beginning of the request. 

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

 

Value 
Meaning 
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. When ASize is omitted, the default value of 0 is assigned. 

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. 

Use EndWork to close the work mode event for the current level. 

Use DoWork to signal when bytes for the current work level are handled. 

When WorkTarget is assigned, work mode events are signalled in the TIdComponent identified by WorkTarget instead of the current object instance.

Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.