TApxComPort.SWFlowControl

TApxComPort

property SWFlowControl : TAxSWFlowControl
TAxSWFlowControl = (swfNone, swfReceive, swfTransmit, swfBoth);

Default: swfNone

Determines the software flow control options for the port.

This routine turns on one or both aspects of automatic software flow control based on the value assigned to the property.

"Receive flow control" stops a remote device from transmitting while the local receive buffer is too full. "Transmit flow control" stops the local device from transmitting while the remote receive buffer is too full.

Receive flow control is enabled by assigning swfReceive or swfBoth to the property. When enabled, an XOff character is sent when the input buffer reaches the level assigned to the BufferFull property. The remote must recognize this character and stop sending data after it is received.

As the application processes received characters, buffer usage eventually drops below the level assigned to the BufferResume property. At that point, an XOn character is sent. The remote must recognize this character and start sending data again.

Transmit flow control is enabled by assigning swfTransmit or swfBoth to the property. The BufferFull and BufferResume properties are not used in this case. When transmit flow control is enabled, the communications driver stops transmitting whenever it receives an XOff character. The driver does not start transmitting again until it receives an XOn character or the application sets SWFlowControl to swfNone.

See "Flow Control" in the printed documentation for more information.

The following example enables bi-directional software flow control with limits at the 25% and 75% levels of the buffer. The default characters are used for XOn and XOff. Later in the application, software flow control is disabled.

ApxComPort.BufferFull := 75;
ApxComPort.BufferResume := 25;
ApxComPort.SWFlowControl := swfBoth;
...
ApxComPort.SWFlowControl := swfNone;

See also: HWFlowControl