开发者

SerialPort class in .Net: a good idea?

开发者 https://www.devze.com 2023-03-26 08:46 出处:网络
I need to communicate through a rs232 serial port using a .Net application. A Win32 solution has already been code开发者_高级运维d, but we have trouble with ports that stay opened when we try to close

I need to communicate through a rs232 serial port using a .Net application. A Win32 solution has already been code开发者_高级运维d, but we have trouble with ports that stay opened when we try to close them.

I found the class SerialPort in .Net Framework 3.5 and wanted to know if it is a good idea to use it or if there are some unresolved known issues.


I always had a problem about receiving data off the RS232. Sometimes the event wouldn't fire when it received data from the port. This was a problem I had since using VS 2008 in C#/VB.Net.

One of the solutions I haven't tried yet is OpenNETCF Serial Library on Codeplex but I read that it was developed using P/Invoke and it is much faster since it's on the kernel level, not within the framework. Though it was originally for the Compact Framework, it works just as well in regular version. I read so you need to maintain it yourself since it's not been updated for a long time, but then again, not much hasn't changed for RS232.

Maybe someone else can shed a light on the subject in regards to VS 2010/2012?

0

精彩评论

暂无评论...
验证码 换一张
取 消