Connecting multiple virtual serial ports together

Have you ever had the need to connect multiple programs that utilize serial ports? Or you tried to stream the data from single GPS device to multiple programs that needed the data? Then either you found out it can’t easily be done using the tools avalible on windows, or after some research online you stumbled upon com0com and hub4com which is part of com0com project (although distributed separately).

Com0Com is actually a null modem cable emulator, so it can be used to emulate pairs of serial ports that are virtually interconnected.You can get it at at its sourceforge page. If you have one of newer windows versions that don’t allow installing unsigned drivers you should probably download the version from the official site or you can get signed at this page.  The installer is pretty straightforward. During the installation you can also choose to add two example pairs of ports (one with Ports class and one without).

After installing Com0com you can configure it using the setup program (which has a very descriptive name – Setup :P, but you can distinguish it by the port icon). Here is the setup screen, which is pretty intuitive by itself (except for Ports class meaning and signal routing).

2014-12-15 21_16_32-Setup for com0com

Only ports with Port class checkbox checked will be available as “normal” serial ports to most programs. Ports without Ports checkbox checked can however still be used by utilities like hub4com. There are also additional checkboxes with more advanced features, which you probably won’t need to touch.

The serial port pair setup dialog also features advanced virtual cable setup, which allows you to choose which serial port signals from one port connect to which signals on the other port. Signal routing can be changed by clicking (and hodling mouse button) on one colored dot connector and dragging a signal to second colored dot connector. A negation of the signal can be obtained by doubleclicking on the green dot connector. On touchpad single click seems to disconnect the signal for me (but that does not seem to work with the mouse?). Up to current time I have not yet had the need to connect those extra signals on any of the programs I use.

Com0com creates virtual ports that are connected to each other, so you can use them to connect two programs to communicate using a pair of ports, for example GPS simulator (data source) and GPS client application (data client). Of course the communication can also be bidirectional like sinchronization of two programs.

(This is a multipage post. Read on for examples and using hub4com for connecting multiple ports >>)

Tagged with: , , , ,
3 comments on “Connecting multiple virtual serial ports together
  1. Louis Carrel says:

    Thanks for the article, a very nice read! However, I would like also to add, that there are also other pieces of software that can create virtual COM ports or let you connect a real device with a virtual port. All additional details can be found in the articles, like this one
    Software to connect real devices to a virtual serial cable

  2. Is it possible to switch baud rate up to 57600?
    Can you describe it?

    • dejko1 says:

      The com0com emulation normally doesn’t care about the baudrate, so you can safely connect with 57600 baud on one virtual port and 9600 baud on other port (which would not be possible in physical word). Actually com0com won’t emulate the baudrate mismatch on virtual fable (wrong data you would get), however you can use the “enable baud rate” tick to emulate the timings/delays caused by sending at the chosen baudrate.

Leave a Reply

Your email address will not be published. Required fields are marked *