back to index
daemontools install instructions
ucspi-tcp install instructions
getting started with tcpserver
setup of a daytime server
common tcpserver setups

Getting started with tcpserver

Some people think that using tcpserver is complicated. It really isn't. In the following example you'll run a fake telnetd that simply prints a string to the network and then closes the connection.

Fake telnetd

In a shell window, run this command line:


tcpserver -v -RHl0 127.0.0.1 2023 sh -c "echo 'Go away!'"

In another shell window, connect to the fake telnetd:


telnet 127.0.0.1 2023

Explanation of tcpserver command line options


-v

tcpserver writes status messages to stdout. In a real world setup multilog will pick up the logging information.


-RHl0

This prevents various DNS lookups. See the man page for details.


127.0.0.1 2023

Listen on 127.0.0.1, port 2023.


sh -c "echo 'Go away!'"

This is the program that tcpserver runs upon each connection.

Real world example

A complete setup of a daytime server.


Contact:

Stefan Krah <website @ bytereef.org>