2

I have a problem with opening/closing com port - my program works perfect for some time, and than immediately stops working. Without any exception or anything like that. The only solution is disconnecting USB modem, then closing debugger (debugging won't stop if i don't disconnect modem).

Modem which i use is USB Huawei E173, program runs on Windows 10 64bit.

On my private pc (Windows 7 64bit) the same program and the same modem runs perfect, without any problem. So the problem is OS/PC settings.

Here is my simple program written in C#.

        static void Main(string[] args)
    {
        SerialPort mySerialPort = new SerialPort("COM8");

        mySerialPort.BaudRate = 230400;
        mySerialPort.Parity = Parity.None;
        mySerialPort.StopBits = StopBits.One;
        mySerialPort.DataBits = 8;
        mySerialPort.Handshake = Handshake.None;
        mySerialPort.RtsEnable = true;

        while (true)
        {
            mySerialPort.Open();
            Console.WriteLine("Opened " + DateTime.Now);
            mySerialPort.Close();
            Console.WriteLine("Closed " + DateTime.Now);
            Thread.Sleep(3000);
        }


    }
AnotherSimpleName
  • 151
  • 1
  • 1
  • 9
  • It seems that it has to do with OS version? I tried this program with the same modem and the same driver on win 7 64 (two different) - both works ok. On win 8.1 64, win 10 64 and windows server 2008 the program has problem. – AnotherSimpleName Sep 01 '16 at 07:21

1 Answers1

0

It seems that it was drivers thing. I installed driver from this modem and it works great on win 10 and server 2008 R2.

AnotherSimpleName
  • 151
  • 1
  • 1
  • 9