Is it possible to simulate com port sending and receiving data using only C# programming?

16,568

Solution 1

The best way to do this is to use a software COM port emulator. I use com0com :

Null-modem emulator

This provides virtual NM COM port pairs on the system (ie: what is output to one is input to the other and vice-versa). The devices show up in Device Manager just like a real COM port so you interact with them in C# as though they were real hardware devices.

Solution 2

For simplicity's sake, get yourself a com port or null modem emulator. You'll get very far off track, and maybe waste a lot of time, trying to do this yourself.

See this post, too: Faking an RS232 Serial Port

Share:
16,568
abdolah
Author by

abdolah

Updated on June 04, 2022

Comments

  • abdolah
    abdolah almost 2 years

    I have a device which sends data by com port on my computer.

    I know how to simulate it, but the controller must be plugged in to simulate sending data (using Proteus)

    Is it possible to simulate the com port sending data without having any external device plugged in?

    For example: I want to write a C# program which opens the com port and waits for data, and another c# program which writes data on the same port.

  • Emin Niftiyev
    Emin Niftiyev almost 2 years
    I know it's been a long time. Can you give detailed information about how you did this?
  • J...
    J... almost 2 years
    @EminNiftiyev Download and run the installer.
  • Emin Niftiyev
    Emin Niftiyev almost 2 years
    The app was very helpful Thank you