* Siegfried Heintze <siegfried / heintze.com> [1024 05:24]:
> 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.

do you mean like tits? It's in C and written for NetBSD, but should be
easy enough to port to another *NIX. It should at least give you an idea
how the framework would work:

-------------------------------------------------------
rasputin@lb:booty$ cat /usr/pkgsrc/*/tits/DESCR
The tits command is a server process which provides telnet(1) access
to one or more tty ports as specified in config-file (or
/etc/tits.conf if no configuration file is specified on the command
line).

Any number of telnet(1) clients may connect to a single tits port.
Each client will see exactly the same output as well as being able to
send keystrokes simultaneously.
-------------------------------------------------------


Hang on, I just realised you are *never* going to find that via Google,
although it may be fun looking ^_^


-------------------------------------------------------
rasputin@lb:booty$ grep MASTER_SITES /usr/pkgsrc/*/tits/Makefile
MASTER_SITES=   http://www.mctavish.co.uk/tits/
rasputin@lb:booty$
-------------------------------------------------------

 
> 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 ruby,
> 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? 

-- 
Everybody's a jerk. You, me, this jerk. - Bender
Rasputin :: Jack of All Trades - Master of Nuns