[Tutor] How to reinvent telnet for serial port?

Kent Johnson kent_johnson at skillsoft.com
Sun Oct 3 14:59:58 CEST 2004


Take a look at PySerial - http://pyserial.sourceforge.net/ The 
tcp_serial_redirect.py sample program that comes with it seems to meet all 
your requirements. It is a multi-threaded application that forwards from a 
serial port to a tcp port and vice versa.

Kent

At 09:28 PM 10/2/2004 -0600, Siegfried Heintze wrote:
>I need to write a program similar to a telnet server. A telnet server
>asynchronously reads data from a socket and writes it to a
>sub-process, and asynchronously reads data from the subprocess and
>writes to a socket. My program needs to replace the subprocess with a
>serial port.
>
>The telnet server cannot anticipate when data will arrive from the
>socket. Neither can it anticipate when data will arrive from the
>subprocess.
>
>How can I write a similar OS vendor neutral program using Python,
>except, instead reading and writing to a process, I read and write to
>serial port? Can I do this with a single thread? How do I read and
>write to a serial port? Can anyone point me to some sample code for
>serial port I/O?
>
>   Thanks,
>      Siegfried
>_______________________________________________
>Tutor maillist  -  Tutor at python.org
>http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list