Handshake Enum
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Specifies the control protocol used in establishing a serial port communication for a SerialPort object.
public enum class Handshake
public enum Handshake
type Handshake =
Public Enum Handshake
- Inheritance
Fields
None | 0 | No control is used for the handshake. |
RequestToSend | 2 | 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 |
RequestToSendXOnXOff | 3 | Both the Request-to-Send (RTS) hardware control and the XON/XOFF software controls are used. |
XOnXOff | 1 | 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. |
Examples
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.
static Handshake SetPortHandshake(Handshake defaultPortHandshake)
{
String^ handshake;
Console::WriteLine("Available Handshake options:");
for each (String^ s in Enum::GetNames(Handshake::typeid))
{
Console::WriteLine(" {0}", s);
}
Console::Write("Enter Handshake value (Default: {0}):", defaultPortHandshake.ToString());
handshake = Console::ReadLine();
if (handshake == "")
{
handshake = defaultPortHandshake.ToString();
}
return (Handshake)Enum::Parse(Handshake::typeid, handshake);
}
public static Handshake SetPortHandshake(Handshake defaultPortHandshake)
{
string handshake;
Console.WriteLine("Available Handshake options:");
foreach (string s in Enum.GetNames(typeof(Handshake)))
{
Console.WriteLine(" {0}", s);
}
Console.Write("Enter Handshake value (Default: {0}):", defaultPortHandshake.ToString());
handshake = Console.ReadLine();
if (handshake == "")
{
handshake = defaultPortHandshake.ToString();
}
return (Handshake)Enum.Parse(typeof(Handshake), handshake, true);
}
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
Remarks
This enumeration is used with the Handshake property.
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기