COM port programming and .Net


I am doing some work at the moment that requires me to talk to a GPS device over an rs232 connection.  Unfortunatly there are currently no classes in the .Net Framework 1.1 to do this … which means having to either use MSComm ActiveX control (yuk) or doing a world of Platform Invoke commands to call the Win32 APIs.


While stumbling around on the net to find some sample of what is required i found this article in the MSDN magazine (plus code) that gives a multithreaded base class in C#.  It nicely wraps a whole BUNCH of the stuff you dont want to figure out the hard way.


http://msdn.microsoft.com/msdnmag/issues/02/10/NETSerialComm/default.aspx


Great starting place if you want to do some simple COM port work.

Comments (5)

  1. russ says:

    I can’t remember where I came across this on MSDN, but here is a VB.NET class that does a similar thing. It works great for communicating over the serial port, and I am using it in production code with great success.

  2. Cory Smith says:

    Also, just wanted to point out that I’ve provided the source to a .NET clone of the MSComm ActiveX control. It’s located at http://www.gotdotnet.com/Community/Workspaces/Workspace.aspx?id=0a680784-1d84-4e0a-8a62-9dcbcf79e1fb

  3. Kameshwar.P.V says:

    How to use MSComm control in ASP and ASP.NET, I tried a lot but cannot find a solution. I would even like to ask is it feasible to use MSComm control in ASP like.