.NET RS232 Serial Port communication with RS232.dll

A lot of people are coming to this site searching for .NET Serial communications on Google. And while Paul Wilson made it known that System.IO.Ports.SerialPort will arrive in .NET Framework 2.0, that fact is not really useful to you if your project is due next week.

.NET Serial CommunicationJonathan Travers from Berkshire, England, is an experienced engineer, who just recently started playing with .NET and, according to his site, is impressed with Linux OS. He publishes and sells the RS232.dll .NET library for serial port communication (via C# or any other .NET-supported language), and the current price is 10 British pounds, which is pretty much a giveaway. My employer got a copy of the DLL, and so far it’s been probably the easiest tool for RS232 communication.

Download Jonathan’s help file, which he distributes for free. The instructions include adding the RS232Comms component to the Toolbox in Visual Studio, but apparently the example works only under Visual Studio .NET 2003 and higher as I have been unable to make an addition to my toolbox in the original Visual Studio .NET. Nevertheless, adding a DLL to the application is easy, and in older version of VS you just need to create a reference.

The objects reside in RS232 namespace, and you can specify the COM port number, baudrate, parity, stopbit, data bits, flow control settings and timeout value for the port. After initializing the port and setting all the parameters for the object, calling OpenComms() opens the serial port. WriteChar, WriteByte, WriteBlock(byte[]) and WriteBlock(string) account for majority of the data you’d want to send to the COM port, while everything that’s received can be handled in public event DataReceivedHandler DataRxEvent. The receiving part is completely event-driven, so no need to set up the timers and implement polling for the RS232 data, which can sometimes result in buffering errors and subsequent data loss.

public event CTS_EventHandler CTS_Event and public event CTS_EventHandler DSR_Event are there as well, but for my project I did not need them. Logging is enabled, so after discovering some errors that need debugging you can pull the data out of the ArrayList (which is really nothing more but a bunch of log strings):

ArrayList opencom = com1.GetPortOpenLog();

  • Yuri Astrakhan

    I recently started a sourceforge library project that implements most of the .Net 2.0 serial port specifications but compatible with the .Net 1.1 framework. The project is located at http://sourceforge.net/projects/serialportnet

    My goal is to be .Net 2.0 compatible, while adding support for serial to network converters and linux. This is still a work in progress, so any help is welcome.

  • Imran Khatri

    I need to communicate with COM port, through IE on the client, code written in asp.net,
    How to achieve that.

    Imran Khatri.

  • ujku

    Why the links under “.NET RS232 Serial Port communication with RS232.dll” are not working?

  • http://dontpublish Nicholas Kerr


    I need to communicate with the serial port. (Windows)
    But I want to do it with Ruby or get ruby to call
    some c code from ruby ( I think they call this a cwrapper?)

    I want to send serial info into the serial port from rfid
    reader and process this info with ruby.

    I am quite happy to pay sent me a quote .


  • Jonathan Travers

    The component is free for download at:

    Jonathan Travers

  • Swapnil

    Hello Jonathan

    I am using serial port communication since long time.
    But never face such problems
    Actually we have one unit connected to the serial port and we pass on the values to it The Unit gets values configurs it and replies back.
    This is done with lot of times with different units.
    But the problem comes this time
    When we are sending some data to unit of some 100 characters in length.
    then the unit doesn’t respond in well some characters are missing out in between.
    I am really not knowing wht happens since when we are using it with the hyperterminal then every thing works fine. All data gets configured well
    I have tried with the monk and was able to see the data coming on serial port is right But what happens when it goes to the unit.
    please guide me I am now trying the one you gave here
    lets see
    please reply back on my mail