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.
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
tcpserver writes status messages to stdout. In a real world setup multilog will pick up the logging information.
This prevents various DNS lookups. See the man page for details.
Listen on 127.0.0.1, port 2023.
sh -c "echo 'Go away!'"
This is the program that tcpserver runs upon each connection.
A complete setup of a daytime server.