Menu

Tree [52fba5] master /
 History

HTTPS access


File Date Author Commit
 .gitignore 2020-04-25 Paul Osmialowski Paul Osmialowski [45d8ec] Initial commit
 AUTHORS 2020-04-25 Paul Osmialowski Paul Osmialowski [45d8ec] Initial commit
 CMakeLists.txt 2020-06-24 Paul Osmialowski Paul Osmialowski [625eb1] cmake: improve Debug builds
 COPYING 2020-04-25 Paul Osmialowski Paul Osmialowski [45d8ec] Initial commit
 Makefile 2020-04-26 Paul Osmialowski Paul Osmialowski [0e8a8c] connection: add the ability to limit the number...
 README.md 2020-05-14 Paul Osmialowski Paul Osmialowski [58c0cc] server: add ability to send MOTD to every new c...
 connection.c 2020-06-20 Paul Osmialowski Paul Osmialowski [9f069c] connection: silly bug in connection error handl...
 connection.h 2020-07-04 Paul Osmialowski Paul Osmialowski [d812a4] connection: use unsigned literal for name length
 debug.h 2020-04-25 Paul Osmialowski Paul Osmialowski [45d8ec] Initial commit
 main.c 2024-06-22 Paul Osmialowski Paul Osmialowski [52fba5] tty: those file descriptors here were set by a ...
 rawtty.c 2020-04-25 Paul Osmialowski Paul Osmialowski [45d8ec] Initial commit
 rawtty.h 2020-04-25 Paul Osmialowski Paul Osmialowski [45d8ec] Initial commit
 ringbuf.c 2020-04-25 Paul Osmialowski Paul Osmialowski [45d8ec] Initial commit
 ringbuf.h 2020-04-25 Paul Osmialowski Paul Osmialowski [45d8ec] Initial commit
 server.c 2024-05-18 Paul Osmialowski Paul Osmialowski [9088b6] connection: this was a bad assertion
 server.h 2020-04-25 Paul Osmialowski Paul Osmialowski [45d8ec] Initial commit
 spawn.c 2020-04-25 Paul Osmialowski Paul Osmialowski [45d8ec] Initial commit
 spawn.h 2020-04-25 Paul Osmialowski Paul Osmialowski [45d8ec] Initial commit
 telnetd.c 2020-04-25 Paul Osmialowski Paul Osmialowski [45d8ec] Initial commit
 telnetd.h 2020-04-25 Paul Osmialowski Paul Osmialowski [45d8ec] Initial commit

Read Me

Stdiotelnetd

This is a simple TCP server wrote around libtelnet library and using telnet
protocol for the communication. By default it waits on a given TCP port and when
contacted by a telnet client, it enables interactive communication between
the users sitting on either side of the connection. It can also execute a
program specified as a command line argument (with its own arguments passed
through as needed) having both stdin/stdout of this program redirected to
any telnet client connected. Note that only one instance of the program will
ever be spawned, hence all of the connected clients will be seeing the same
content, effectively being able to observe the effects of the other connected
users actions (namely, if the spawned program responds with echo, all the users
will be seeing what the others are typing).

Usage guidelines

The command line syntax for invoking stdiotelnetd is following:

stdiotelnetd <waitport> [<cmd> [-- [<args>]]]

By default, after being connected, the telnet client programs are instructed
not to use local echo and give up the line mode. This means, all the keystrokes
are sent immediately (without waiting for the Enter key), and the effect of
those keystrokes will not be seen on the client side unless the server side
start to send them back. Both those behaviours can be prevented by setting the
following environment variables:

  • TELNET_TELOPT_ECHO - encourage clients to use local echo
  • TELNET_TELOPT_LINEMODE - encourage clients to work in the line mode (any
    text will be sent to the server only after the user presses the Enter key)

For example, the following command:

$ TELNET_TELOPT_ECHO=1 TELNET_TELOPT_LINEMODE=1 ./stdiotelnetd 2048

...will start stdiotelnetd that will wait at TCP port 2048 and will not be
instructing the telnet clients to stop outputing local echo and give up line
mode.

The TELNET_MOTD environment variable can be used to set the 'message of the
day' sent to every new connection, e.g.:

$ TELNET_TELOPT_ECHO=1 TELNET_MOTD="Welcome to my system." ./stdiotelnetd 2048

How to build it?

This program requires libtelnet library. Depending on the version you may
came across, it can provide either pkg-config or CMake guidance files.
For that reason, both the Makefile and CMakeLists.txt files were prepared.

If your libtelnet library is pkg-config compatible, just run make to build
this program.

If your libtelnet library is CMake compatible, use CMake as such:

$ mkdir build
$ cd build
$ cmake /path/to/stdiotelnetd/sources
$ make

Caveats

Does not work well with Putty. Use any usual command-line telnet client instead.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.