Eli Fulkerson .com HomeProjectsTelnet-serial-bridge

tsb.py - a telnet to serial bridge.

Oops! Versions between March and May 2011 were broken! Sorry :( It should work again now.

Download current versions: (May 2011)

tsb.py - single user, telnet server mode, python file
tsb.zip - single user, telnet server mode, as an .exe
tsb-multi.py - multi user, telnet server mode, python file
tsb-multi.zip - multi user, telnet server mode, as an .exe
tsb-client.py - single user, telnet client mode, python file
tsb-client.zip - single user, telnet client mode, as an .exe
tsb-build.zip - source code and build environment


This is a python program that acts as a go-between between a telnet port and a serial port. In effect, this adds serial port connectivity to terminal programs which lack it. As a secondary function, it could be used to share a serial port over the internet, if you needed such a feature.


Usage: tsb [OPTIONS]
Creates a TCP<->Serial port bridge, which allows a telnet client to
cross over a Serial port.

Serial Options:
   -p, --port     :  Specify the desired serial port.
                     (0 for COM1, 1 for COM2 etc)
   -r, --baudrate :  Specify baudrate
   -s, --bytesize :  Specify bytesize
   -y, --parity   :  Specify parity options
   -b, --stopbits :  Specify number of stopbits
   -t, --timeout  :  Specify timeout
   -f, --flow     :  Specify flow-control options

TCP Options:
   -l, --listen   :  Specify a TCP port to listen on

General Options:
   -h, --help     :  Display this help messsage

Usage (telnet client version):

This version differs from the original in that it runs as a client rather than a server, which allows the user to connect to a remote data source and redirect it to a local serial port. Also, this version of the script no longer tries to remove any telnet negotiation from the data stream. The alternate usage flags are as follows:

TCP Options:
   -c, --connect   :  Specify a TCP port to connect to
   -i, --ip        :  Specify the IP address or hostname of the host to connect to

Same general thing as the original, it just runs in reverse. The code will read a little funny as I didn't adjust any of the verbs (we are no longer listening for instance), but thats just how it is.


  • Tested on Win32. Will likely work under unix/mac/etc if you load the proper libraries (pySerial)
  • Language:

  • Python
  • License:

  • The tsb.py script is available under the GPL.

  • Updates!

    16 Jun 2010 - Thanks to Dmitrij Belogaj, who finished off my incomplete multi-user support, there is now a multiple user version. You can open as many TCP connections as you like, they will all mirror eachother.
    Nov 2010 - Control-break support and cannot-open-port bugfix.
    Mar 2011 - control-bit flag fix and fresh .exe versions.