返回主页
虚拟光驱软件 DaemonTools 安装说明
ucspi-tcp 软件包安装说明
tcpserver 使用详解
设置一个 daytime 服务器
命令行版 tcpserver 安装指南

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.


联系我们:

Stefan Krah <website @ bytereef.org>

本站内容由中国分布式计算总站组织翻译。