# SetCTSMode

int SetCTSMode (int COMPort, int hardwareHandshaking);

## Purpose

Sets the hardware handshaking mode.

By default, hardware handshaking is not used.

When you enable hardware handshaking, the CTS line is monitored to determine when it is safe to send characters to the receiver. Also, the RTS line is raised only when there is space in the input queue to receive additional characters. Optionally, you can tie the DTR line to the RTS line.

SetCTSMode returns an error if you have not opened the port or if you pass an invalid parameter value.

## Parameters

Input
Name | Type | Description
COMPort | integer | A number that indicates the COM port on which to operate. This number is paired with deviceName, which represents the COM port, during the OpenComConfig function call. Default Value: 1—COM1 Valid Range: 1—1,000
hardwareHandshaking | integer | The hardware handshaking mode for the selected port. Use hardware handshaking to control the flow of data between the sender and receiver so that the receiver's input buffer does not overflow.
Value | Defined Constant | Description
0 | LWRS_HWHANDSHAKE_OFF | Hardware handshaking is disabled. The library ignores the CTS line, and raises the RTS and DTR lines the entire time the port is open.
1 | LWRS_HWHANDSHAKE_CTS_RTS_DTR | Hardware handshaking is enabled. The library monitors the CTS line and uses the RTS and DTR lines for handshaking.
2 | LWRS_HWHANDSHAKE_CTS_RTS | Hardware handshaking is enabled. The library monitors the CTS line, uses the RTS for handshaking, and raises the DTR line the entire time the port is open.

## Return Value

Name | Type | Description
result | integer | The result of this function call. This code is a negative value that specifies the type of error that occurred.