|
||
The member function Read()
normally completes when one of the following conditions is true, depending on the variant called and the actual data that
comes in to the port:
when the TDes8
descriptor passed to it as an argument becomes full
when a specified number of character passed as an optional argument has been received
when a time-out passed as an optional argument expires
when the client calls ReadCancel()
We have seen that a port can be configured to extend the conditions under which a read request completes, but even this is not efficient enough when a program needs to respond quickly to the content of the data that is sent. For example, if we need to process variable length lines of text, we really need our read request to complete as soon as the line end is detected. However, the last thing we want to do in this situation is to start issuing read requests for every single character. Clearly, we need to be able to configure a port so that read requests can complete on the basis of the data that is actually received.
Cases like this are catered for by allowing us to specify up to four characters as terminators when we configure a port.