Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4024816
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:46:07+00:00 2026-05-20T10:46:07+00:00

I have device which is connect to PC via USB Serial communication. I am

  • 0

I have device which is connect to PC via USB Serial communication. I am performing following steps

  1. Start Device (Power On)
  2. Device will detected in my PC as COMx name
  3. Start my application
  4. On base of COM PID/VID, I connect to device
  5. Perform communication. (Up to this I am not facing any problem)
  6. when I switch off device, device is disconnected but I cannot able close connection.
  7. When I again start(Switch on) device, Device is detected but my application cannot able to connect to COMx(device). It throws IOException "COMx does not exist"

So I think I have some way to close communication port forcefully.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:46:08+00:00Added an answer on May 20, 2026 at 10:46 am

    I have found solution though it can not be called standard solution but though i don’t have any problem with that solution because it solves my problem the solution is as per belove step

    1. Create class.
    2. Create and dispose instance of this class every time you want to send data.

    FIRST STEP:-

        class clsRS232 : IDisposable
        {
            private SerialPort myPort;
            public clsRS232()
            {
                myPort = new SerialPort("COM3", 9600, Parity.None, 8, StopBits.One);
            }
            public void OpenPort()
            {
                myPort.Open();
            }
            public void SendFunc(string str)
            {
                myPort.Write(str);
            }
            public string ReadFunc()
            {
               return  myPort.ReadExisting();
            }
    
            public void Dispose()
            {
                myPort.Dispose();
            }
    
        }
    

    SECOND STEP:-

    using (clsRS232 mySerialPort = new clsRS232())
                        {
                            lock (mySerialPort)
                            {
                                mySerialPort.OpenPort();
                                mySerialPort.SendFunc(commandArg);//here "commandArg" is command or data you want to send to serial port
                                this.serialPortObj_DataReceived(mySerialPort.ReadFunc()); //here "serialPortObj_DataReceived()" is a user define method where received data will be passed
                            }
                        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a device that connects to pc via USB, which gets mapped to
I have the following setup: The server will connect via Bluetooth to several devices
I have a device to which I'm trying to connect via a socket, and
I have an application in vb.net which will connect with an hardware device and
I have a USB GSM device which I use for Internet connection as well
We have made a device which can act as an USB host or slave
I'm trying to create an iOS application which upon loading, will initially connect via
I have a windows mobile 6.5 device which is not being detected by the
I have a GSM modem connected via USB. The modem creates 2 serial ports.
HI, I have a device that exposes a telnet interface which you can log

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.