1. Home
  2. Virtual null-modem pairs

A virtual null-modem cable for Windows

Create two virtual COM ports wired together, so two programs on the same PC can talk as if a serial cable connected them.

What is a virtual null-modem?

A null-modem cable connects two serial ports directly, crossing the transmit and receive lines so that what one side sends, the other receives. A virtual null-modem (or virtual serial port pair) does the same thing in software: it creates two COM ports, and every byte written to one comes out of the other.

It is the standard way to test serial software without hardware: connect your application to a device simulator, a terminal, or a test script, all on one PC.

Create a virtual serial port pair

  1. Install SerialLoom.
  2. Press Virtual pair in the toolbar of the topology view (or New pair under Virtual ports).
  3. SerialLoom creates two virtual ports, for example COM30 and COM31, and connects them.
  4. Open COM30 in one program and COM31 in the other. Type in one, read in the other.
SerialLoom topology with a virtual null-modem pair COM30 and COM31 and the traffic monitor

Create a pair from a script

Automated tests can create their own pair and remove it afterwards with serialloom-cli, which is installed with SerialLoom. Turn on Settings > Automation first. In Python:

import subprocess

CLI = r"C:\Program Files\SerialLoom\serialloom-cli.exe"
a, b = subprocess.run([CLI, "pair"], capture_output=True, text=True, check=True).stdout.split()
try:
    ...  # open ports a and b with pySerial and run the tests
finally:
    subprocess.run([CLI, "delete", a], check=True)

Use serialloom-cli pair COM41 COM42 to pick the numbers. SerialLoom Helper creates and removes the ports without an administrator prompt, and the CLI starts SerialLoom in the background if it is not running. More about automation.

Typical uses

  • Developing serial software: run your application against a simulator script instead of a real instrument, PLC or modem.
  • Automated tests: drive a COM-port-based program from pySerial, .NET or Node in CI or on your desktop, with the test creating and removing its own pair (see above).
  • Connecting two legacy programs: link a program that outputs data on a COM port to one that reads data from a COM port.
  • Simulating devices: replay recorded NMEA, Modbus RTU or barcode scanner data into the software under test.
  • Learning and teaching: experiment with serial protocols with two terminal windows and no wiring.

See what passes between the programs

Click the pair's connection to open the inspector. The traffic monitor shows every chunk of data with a timestamp and the port that sent it, in ASCII or hex. The topology also shows the baud rate and framing each program chose, so you can spot a mismatched setting at a glance.

More than a pair

A pair is a bridge between two virtual ports. The same canvas also lets you build larger setups:

  • Add a third program with a bus, where every port hears every other.
  • Put a real device in the middle with a split, so your app and a logger both see its data.
  • Move one end of the pair to another PC with a TCP bridge.

Good to know: data passes between the two ports at full speed regardless of the baud rate either program sets. Mirroring baud rate and the DTR/RTS lines to the other side is on the roadmap.

Questions

Is this the same as com0com?

It serves the same purpose as com0com's paired ports, but runs on 64-bit Windows 10 and 11 without test-signing mode and adds a visual editor, splitting and TCP bridging. Full comparison.

Can I choose the COM numbers of the pair?

Yes. Pick the numbers when you create the pair, or use Change number later.

Do both programs need to use the same baud rate?

No. Virtual ports do not slow data down to the baud rate, so the programs exchange data even with different settings. The topology shows each program's setting in case the real device will care.

Can my tests create and remove the pair themselves?

Yes. Turn on Settings > Automation, then call serialloom-cli pair at the start of a test run and serialloom-cli delete at the end. It works from any language that can start a program, including Python, C#, Node.js and batch files. Automation guide.

Weave your serial ports together

Free and open source. One installer, no test mode, no extra drivers to hunt down.

Latest v0.2.0 · Windows 10 (1803+) and Windows 11, x64 · MIT license