La comunicación del puerto serie en la misma máquina Windows no funciona
Disculpe, pregunta rápida:
Tengo esta configuración de hardware:
Misma máquina: "Com3" -> USB -> A serie -> A USB -> "Com4"
Y seguiClase MSDN SerialPort yMSDN SerialPort.ReadLine () para construir esta rutina:
SerialPort SendSerialPort = new SerialPort("Com3", 9600);
SerialPort ReceiveSerialPort = new SerialPort("Com4", 9600);
SendSerialPort.Open();
ReceiveSerialPort.Open();
SendSerialPort.WriteLine("Test");
var message = ReceiveSerialPort.ReadLine(); // control stops here
SendSerialPort.Close();
ReceiveSerialPort.Close();
Console.WriteLine(message);
Sin embargo, cuando tiendo aReadLine()
, mi control se detiene y solo espera. No esperaba eso.
Estoy esperando recibir la cadenaTest
y asignarlo a mivar message
. ¿Podría decirme qué estoy haciendo mal aquí?
EDITAR:
Probé mi hardware usando elAplicación de utilidad de puerto serie yfuncionó bien.