Home » Projects » Telnet-serial-bridge.php


tsb.py - a telnet to serial bridge.

Description:

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 programs such as PuTTY, 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.

PuTTY users! You probably want to adjust the following settings. Under "Terminal", turn "Local echo" to "Force off" and "Local line editing" to "Force off".

Usage:

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

Platform:

  • 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.
  • Download:

    tsb.py - the script itself
    tsb.exe - compiled and packaged to be standalone under windows.
    tsb-src.zip - the source + build script for py2exe


    Update! (16 Dec 2006):

    By popular demand... here is a client-mode version of tsb. 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.