By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,890 Members | 1,226 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,890 IT Pros & Developers. It's quick & easy.

SerialPort c# .NET 2.0

P: n/a
I'm trying to convert from a lot of invoked code to c# 2.0 SerialPort code.
I can't find a way to set fOutxCtsFlow to true (maybe CTSEnable?) and
fRtsControl = RTS_CONTROL_HANDSHAKE (RtsEnable?). Also, do I need to set
the handshaking? Below is the old and attempted new (that continually gets
a timeout error on read. I upped the read timeout, but it's way too long
NOT for it to be a handshaking or other issue than the readtimeout setting.
Thanks in advance, Joshua Moore

Part of the old code to open the serialport connection was:

DCB dcb;

GetCommState(m_CommHandle, &dcb);

dcb.BaudRate = 57600;

dcb.ByteSize = 8;

dcb.Parity = NOPARITY;

dcb.StopBits = ONESTOPBIT;

dcb.fOutxCtsFlow = TRUE;


SetCommState(m_CommHandle, &dcb);


serialPort = new System.IO.Ports.SerialPort("COM1", 57600,
System.IO.Ports.Parity.None, 8, System.IO.Ports.StopBits.One);

serialPort.Handshake = System.IO.Ports.Handshake.RequestToSend;

// serialPort.ReadBufferSize = 2047;

// serialPort.WriteBufferSize = 2047;

serialPort.RtsEnable = true;

serialPort.ReadTimeout = 800;

serialPort.WriteTimeout = 30;
Jan 5 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.