简体   繁体   English

波特率错误时,SerialPort.isOpen返回什么?

[英]What does SerialPort.isOpen return when the baud rate is wrong?

According to the documentation isOpen returns the open or closed status of a SerialPort. 根据文档,isOpen返回SerialPort的打开或关闭状态。 Now if I try to open a port in the correct COM number but with the wrong baud rate. 现在,如果我尝试以正确的COM编号打开端口,但波特率错误。 In theory the port opens but the two ends cannot communicate. 理论上,端口是开放的,但两端无法通信。 So the isOpen method should return true even though the connection is not proper. 因此,即使连接不正确,isOpen方法也应返回true。 Am I understanding this correctly? 我理解正确吗?

Of course you can open a Port with a wrong baudrate. 当然,您可以使用错误的波特率打开端口。 The SerialPort really can't know which baudrate you need, so it will open it, although there is no communicationpartner with same baudrate. 尽管没有通讯伙伴使用相同的波特率,但SerialPort确实不知道您需要哪种波特率,因此它将打开它。

So yes, you are understanding right, it will return true. 是的,您的理解正确,它将返回true。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM