Connecting multiple virtual serial ports together
Now that we know how the com0com works, we can try using it.
Open the com0com setup. Check if there is already a virtual com port pair connected and ensure it has ports class enabled.
If you already have a pair of connected virtual ports with COMx names you can skip the following paragraph.
If there is no pairs already created click Add Pair button to add a new pair. If Windows asks you to restart the computer just close the popup (no restart should be needed). New pairs by default are created as CNCAx <> CNCBx where x is a number. Newly created pairs don’t have port class enabled, so if you want to use them in programs you will have to enable it by checking the checkboxes and pressing Apply button. After enabling the ports class the port will become visible under a new name with COMx naming convention and will be available for use with programs.
Here you can see that I have four COM port pairs installed, the chosen one for this example is COM6 and COM9 pair.
You can also check the device manager to see the ports that are available. The ports available to the programs will be listed under Ports (COM and LPT), while the serial port pairs and non-enumerable ports (available just to applications like hub4com) will be listed under com0com.
Now you can use your favorite terminal emulator software to connect to both of the serial ports to check the functionality. I will use RealTerm software in my example. Open two instances of the program. Open one port from the pair (COM6) in one instance and the other port (COM9) in the second instance of the program. To open ports in RealTerm you need to first choose the port name and then click the Open button. If changing the port settings you either have to click the Open button twice (to open and close the port) or click the Change cutton. You can send the data from one program to another, emulating a null modem cable. For sending data in RealTerm you can either type the data after clicking in the terminal window or you can use the Send tab. Send ASCII button sends the data in the text box next to it.
Using the Pins tab you can also try out the flow control routing of com0com package. By default the DTR of transmitting port is connected to DSR and DCD signal inputs of the second port. RTS is connected to CTS. When you modify RTS or DTR signal on one port using Set or Clear buttons you can see the connected signals change on the other port.
(This is a multipage post. Read on for examples on hub4com for connecting multiple ports >>)