Topic Path: Symbol Reference > Classes > TIdIOHandler Class > TIdIOHandler Methods > WaitFor Method
ContentsIndexHome
PreviousUpNext
TIdIOHandler.WaitFor Method

Searches for a specific value in the input received from the data source for the IOHandler.

function WaitFor(
    const AString: string; 
    ARemoveFromBuffer: Boolean = True; 
    AInclusive: Boolean = False
): string;
Parameters 
Description 
AString 
Values to search for in the internal buffer.
 
ARemoveFromBuffer 
Indicates if data is removed from the internal buffer. Default value is True.
 
AInclusive 
Indicates if extrascted data includes the search value. Default value is False. 

string - Values read from the internal buffer for the IOHandler, or an empty string ('') if the connection is closed.

WaitFor is a String function used to watch for a specific value in the input received from the data source for the IOHandler. WaitFor iteratively calls CheckForDataOnSource using a 250 millisecond timeout to ensure that data is available for the method. 

When the value in AString is detected in the InputBuffer for the IOHandler, it is extracted from the internal buffer and used as the return value for the method. 

ARemoveFromBuffer indicates if all of the data in the buffer up to the specified marker should be extracted from the internal buffer for the IOHandler. When ARemoveFromBuffer contains True, data is extracted from InputBuffer and stored in the return value for the method. 

AInclusive indicates if data extracted from the InputBuffer should inlude the value indicated in AString. When AInclusive contains False, the value in AString is not included in the return value. 

If the value in AString is not detected in the internal buffer, the process is repeated until a disconnect is detected using the CheckForDisconnect method. 

Please note that byte comparisions using AString and the InputBuffer are case-sensitive.

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