找到你要的答案

Q:SerialPort object does not receive any data under Windows XP

Q:SerialPort对象不在Windows XP下接收任何数据

I have a SerialPort object to control a gsm modem connected to a virtual com port. My problem is that i do not receive any data under Windows XP. The DataReceived Event is not triggered nor outputs port.ReadExisting() any data if called periodically. But when i shut down my program and connect with putty to this port, the response of the modem is displayed.

Under Windows 7 data is received correctly.

What could be the problem here?

我有一个SerialPort的对象来控制连接到一个虚拟串口GSM调制解调器。我的问题是我不能在Windows XP下接收任何数据。该事件不会触发DataReceived也输出端口。readexisting()任何数据如果被称为周期性。但当我关闭我的程序和连接到这个端口腻子,调制解调器的响应显示。

在Windows 7数据正确接收。

这里有什么问题?

answer1: 回答1:

Software handshake needs to be enabled.

this.serialPort.Handshake = System.IO.Ports.Handshake.XOnXOff;

I found this out by comparing the putty settings with the serial port settings in my program. So the problem was not the operating system itself, but the used flow control.

需要启用软件握手。

this.serialPort.Handshake = System.IO.Ports.Handshake.XOnXOff;

我发现了这一点,通过比较腻子设置与串行端口设置在我的程序。所以问题不是操作系统本身,而是使用的流量控制。

c#  .net-4.0  serial-port  windows-xp