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

Triggers the OnWork event handler.

procedure DoWork(
    AWorkMode: TWorkMode; 
    const ACount: Int64
); virtual;
Parameters 
Description 
AWorkMode 
Work mode for the peer connection.
 
ACount 
Number of bytes to be handled. 

DoWork is a virtual procedure used to trigger the OnWork event handler that perform updates required when byte values for the operation indicated in AWorkMode and ACount have been processed using the component. 

DoWork is used to signal that the work mode indicated in AWorkMode will be used to handle the number of bytes specified in ACount. 

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

 

Value 
Meaning 
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. 

DoWork updates the internal TWorkInfo record created for the value in AWorkMode using the BeginWork method, and increments the number of cumulative bytes handled for the operation using the value in ACount. 

DoWork signals the OnWork event handler when it has been assigned for the component using the cumulative number of bytes handled for the work mode value in AWorkMode. 

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

Use BeginWork to signal the start of a new level for a specified work mode. 

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

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.