nullmodem - a Utility to loopback Pseudo-Terminals
Jürgen Rinas email homepage
Contents of this page
The Story down
How it works down
My Application down
Documentation down
ChangeLog down
Download down
Published on down
The Story homepage top of page

Don't you know the problem?

1.) You are programming some software that connects to the serial interface of your computer (e.g. some modem software) and you want to test your software without any modem (because it's already in use, isn't it?). So you need two computers and a so called nullmodem with TXD and RXD lines crossed.

But you can do it in a much better way, because you've got a Linux machine: You can connect two equal instances of your program with this nullmodem utility.

2.) You have a connection problem with Pseudo-Terminals (ptys) where one program should connect to an existing pty, but you want to start and stop the program that opens the pty-master. So you need some kind of an adapter: nullmodem.

How it works homepage top of page

Pseudo-Terminals (ptys) are a type of interprocess communication with a master and a slave end. One program (in our case nullmodem) opens the master sides of connections and therefore provides connectible slave sides of connections.

If nullmodem receives some data on one of these connections it retransmits them on all other connections. It can be seen as a network with star-type wiring.

Because the names of the slave side ptys are dynamic, nullmodem creates symbolic links to filenames of your choice.
e.g. the command nullmodem /tmp/loop0 /tmp/loop1 /tmp/loop2
creates a pty-network with 3 slave sides linked to the names /tmp/loop0, /tmp/loop1 and /tmp/loop2.
If you close a slave side connection nullmodem will detect this and provide a new stub to connect to and update the symbolic link.

If you need some more informations on ptys look at the info-pages of the glibc - section "Pseudo-Terminals" or read the man-page of openpty.

My Application homepage top of page
schema.png:my application of nullmodem
my application of nullmodem

I'm using nullmodem for my packet-radio station to connect a softmodem with the linux kernel using the KISS protocol.
This has the advantage that it's possible to exchange/restart the softmodem without terminating the level-2 (AX.25) connection of the transmission protocol. This is very advantageous if you play with some parameters of a softmodem.

I'm even using nullmodem for a pure loopback based on the KISS protocol. So I can initiate connections to my own computer without going "on air".

nullmodem can be seen as a generalization of Frederic Rible's (F1OAT) kissnetd that is optimized to transport KISS packets.

If you know some other applications of this program, please let me know. Maybe it's possible to use nullmodem for a local SLIP loopback - but I've not tested this.

Documentation homepage top of page

For documentation look at the man page of nullmodem.

ChangeLog homepage top of page

nullmodem 0.0.6 - Mon, 06 Apr 2009 20:09:31 +0200

  • added an option to activate blocking io

nullmodem 0.0.5 - Wed, 04 Jun 2008 09:29:36 +0200

  • a few cleanups

nullmodem 0.0.4 - Wed, 3 Aug 2005 20:16:59 +0200

  • a few cleanups

nullmodem 0.0.3 - Sat, 24 Jul 2004 18:31:44 +0200

  • many code cleanups and improvements by J. Carter:
  • class{}ified program
  • using STL containers
  • added lock files
  • more cleanups and improvements by my:
  • added --setuid --setgid options
  • some latency improvements

nullmodem 0.0.2-1 - Sun, 10 Aug 2003 19:58:23 +0200

  • updated to debian Standards-Version: 3.6.0
Download homepage top of page

I've prepared a debian package for this program. You can download this via
apt-get update; apt-get install nullmodem
if you configure your system to include my debian repository.

Published on homepage top of page
Valid XHTML 1.1!

Comments on this page ]