.NET SerialPort problems with RealPort

I’m having trouble with .NET 3.5 SerialPort’s connecting to a Digi RealPort. I can connect to the COM port using Putty for example, so I know the port works to some extent, but when I do the same thing in C#.NET, I get a “A device attached to the system is not working” exception thrown.

My system is Win7, 64 bit, running Visual Studio 2008 with a .NET 3.5 framework. The example code is below. I’m using a ConnectPort X4. There are no problems shown in the Device Manager for COM11.

If I disconnect the ConnectPort X4, I get an expected exception “An unexpected network error occurred.”, so I know that the RealPort is trying to do something when it is connected.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.IO.Ports;


namespace serialtest
{
    class Program
    {
        static void Main(string[] args)
        {
            SerialPort m_SerialPort = new SerialPort();
            string comPort = "COM11";

            m_SerialPort.BaudRate = 115200;
            m_SerialPort.Parity = Parity.None;
            m_SerialPort.DataBits = 8;
            m_SerialPort.StopBits = StopBits.One;
            m_SerialPort.Handshake = Handshake.None;
            m_SerialPort.ReadTimeout = 1000;
            m_SerialPort.ReadBufferSize = 1024;

            m_SerialPort.PortName = comPort;

            m_SerialPort.Open();

            m_SerialPort.Close();
        }
    }
}