echoserver - echo / discard server


echoserver [options]


echoserver is a single threaded server, handling packets coming in on one or more UDP or TCP server sockets and echoing them back to the sender.

options is a is a series of getopt or getopt_long style options. See below for more information.

The server sockets have to be created before. Usually this is done by tcpsocket or udpsocket.

echoserver is a demonstration code.


-d, --discard
Don't echo packets back to the sender.

-i, --interval SECONDS
Length of an accounting period in seconds. The number of bytes received is collected for two periods, after which the data of the oldest period is forgotten.

This option is useless unless used together with -r.

-r, --rules FILENAME
Name of a CDB file containing the accounting / access rules. See RULES, below.

-s, --slots NUMBER
Maximum number of open sockets, including the server sockets.

-t, --timeout SECONDS
Drop inbound TCP connections after that many seconds of inactivity.

Show version information.

Show a list of options or the long help on one.

The use with an argument shows the long helptext of that option, without an argument it will list all options.

Show longer help texts for all or one variable

The use with an argument shows the long help for this option, without arguments it shows the long description of all options.


echoserver implements a simple kind of access control, utilizing a constant database (CDB) file, which is re-opened every 60 seconds.

echoservers rule files are compiled by the tcprules utility from Daniel Bernsteins ucspi-tcp package:

  tcprules CDB-filename TMP-filename <rules-filename
See the ucspi-tcp home page for more information.

echoservers rule resolution is like that of tcpserver, and the rule format is like that of tcprules, with the following exceptions:

  1. There is nothing like $TCPREMOTEINFO in echoserver.
  2. The $TCPREMOTEIP environment variable is not used, but 
     the IP address of the remote host is used instead.
  3. The $TCPREMOTEHOST environment variable is not used, but
     the host name of the remote host is used instead.
  4. echoserver doesn't set environment variables, but
     honors the "limit" variable, which limits how many
     bytes are echoed back during two periods (0 means
     "no limit").

Rules file example,limit="0"


How to start echoserver:

  tcpsocket 0 7 \
  udpsocket 0 7 \
  echoserver -r rules.cdb




Uwe Ohse


Uwe Ohse homepage

IODP tools