locked
Create virtual com port in C#? RRS feed

  • Question

  • I'm working on a project where I am reading from a com port to receive data from a GPS receiver. I can do this without any problems except for one. There is also another application that wants to read from the com port at the same time. I know there are com port splitters that I could use but I'd rather not have to use any 3rd party software. Is anyone aware of any way of emulating a com port so that I can point the other application to this port and have it read the data that I am spitting it?
    Thanks,
    Brady
    Monday, December 12, 2005 7:16 AM

Answers

All replies

  • Moved to the Common Language Runtime group, which covers interop.

    Jon

    Tuesday, December 13, 2005 7:36 AM
  • I don’t believe that this is possible to emulate a com port through the SerialPort class. The only options that I can think would be to write your own device driver or to use some IPC mechanism to send the data from process to the other.

    Thanks,

    Ryan Byington [MS]

    • Unmarked as answer by xbrady Thursday, March 26, 2009 10:25 PM
    Friday, February 17, 2006 5:38 PM
  • Thanks for the reply,
    Unfortunatly I can't send the data from one process to the other because one of them isn't mine. I would have no idea of where to even start with writing my own device driver as I've not had to do something of the sort before. That doesn't mean I wouldn't mind learning though. Does anyone know of a good place to learn, or of a driver template I can go off of?

    Thanks
    Saturday, February 18, 2006 12:48 AM
  • So just for clarification, you are reading from a COM port using the SerialPort class but the other process is also reading the same data correct?  Hmmm, if you have no control over the other process then this is probably going to be tricky.  I believe you can come up with your own "virtual" com port, but currently I don't think there's a pre-built solution for this in C#.

    If you're using Windows CE, these articles might help:

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcebluet/html/ceconCOMPortEmulationFacility.asp 

    By the way, you might also want to check out this article on MSDN about connecting to a GPS:

    http://msdn.microsoft.com/coding4fun/someassemblyrequired/whereami/default.aspx 

    Tuesday, April 18, 2006 8:21 PM
  • Thanks for the reply,
    Ya, I'm pretty sure I'm going to have to create a virtual com port. Read it in and the emulate it to another port number so the other application can be pointed to that port number.
    I'm using Windows XP.
    Ya, so I have no clue as how to create a virtual com port. I have spent hours searching but haven't found anything on how to do it.
    Saturday, April 22, 2006 10:58 PM
  • hello,

    I am doing the same project. Which I have to create a virtual com port, so that other program can read and write data in and out.

    I know there are a lot of products already exist which help you to create a virtual com port e.g. com5 to com16. However, as a programmer we want it to create it by ourself.

    I research on creating virtual device( VxD  )for 95 - 98,  but then you will have to know a lot of WinASM assembler language in order to create a device. It is pretty interesting that Win 95 create all kind of virtual device( by VMM32.exe ) for multi-tasking DOS application.

    As I research on NT/ 2000/ XP they change the vitual device name to ( VDD ). I am currently research on DDK for XP. I just hope there are something that let me to create one

    Wednesday, May 10, 2006 7:21 PM
  • Thanks for the information BurgerKing. Please keep me informed on your findings. I'm still trying to figure this out.
    Saturday, May 13, 2006 8:25 PM
  • I also am trying to create a virtual com port but in C++ anybody have any pointers or tips?
    Wednesday, May 31, 2006 1:27 AM
  • Hi.
    I want to create a virtual com port in Windows Xp environment too. I am using C#. Did you succeed in creating the port?
    Please let me know.

    Tuesday, September 12, 2006 6:31 AM
  • Creating a driver using C# is not possible at the moment.

    There are some vendors offering virtual COM port solutions that can be used from managed code:

    See:
    http://franson.com/serialtools/
    http://www.google.com/search?hl=en&lr=&rls=com.microsoft%3Aen-us&q=virtual+com+port+%22windows+xp%22&btnG=Search

    Tuesday, September 12, 2006 11:39 AM
  • Fine. Thank you. :)
    Tuesday, September 19, 2006 8:11 AM