Handshake Enumeration

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Specifies the control protocol used in establishing a serial port communication for a SerialPort object.

Namespace:   System.IO.Ports
Assembly:  System (in System.dll)

Public Enumeration Handshake

Member nameDescription
None

No control is used for the handshake.

RequestToSend

Request-to-Send (RTS) hardware flow control is used. RTS signals that data is available for transmission. If the input buffer becomes full, the RTS line will be set to false. The RTS line will be set to true when more room becomes available in the input buffer.

RequestToSendXOnXOff

Both the Request-to-Send (RTS) hardware control and the XON/XOFF software controls are used.

XOnXOff

The XON/XOFF software control protocol is used. The XOFF control is sent to stop the transmission of data. The XON control is sent to resume the transmission. These software controls are used instead of Request to Send (RTS) and Clear to Send (CTS) hardware controls.

This enumeration is used with the Handshake property.

The following code example displays the possible values of the Handshake enumeration to the console, then prompts the user to choose one. This code example is part of a larger code example provided for the SerialPort class.

Public Shared Function SetPortHandshake(defaultPortHandshake As Handshake) As Handshake
    Dim handshake As String

    Console.WriteLine("Available Handshake options:")
    For Each s As String In [Enum].GetNames(GetType(Handshake))
        Console.WriteLine("   {0}", s)
    Next

    Console.Write("Enter Handshake value (Default: {0}):", defaultPortHandshake.ToString())
    handshake = Console.ReadLine()

    If handshake = "" Then
        handshake = defaultPortHandshake.ToString()
    End If

    Return CType([Enum].Parse(GetType(Handshake), handshake, True), Handshake)
End Function

.NET Framework
Available since 2.0
Return to top
Show: