Skip to content
TCP echo server to play with TCP KEEPALIVE settings
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
CMakeLists.txt
LICENSE
README.md
list.c
list.h
main.c

README.md

ideal-waddle

standard-readme compliant

This tiny project implements a TCP echo server on standard port 7 in C on GNU/Linux, nothing special about that in general. The purpose is to show why TCP KEEPALIVE packets may be useful from the server side.

Background

RFC1122 Section 4.2.3.6 describes “TCP Keep-Alives” and says:

A TCP keep-alive mechanism should only be invoked in server applications that might otherwise hang indefinitely and consume resources unnecessarily if a client crashes or aborts a connection during a network failure.

This echo server can demonstrate exactly that and also how to mitigate it with TCP keep-alive packets.

Note: you may not need this mechanism if your layer 5 to 7 protocol lets the server part send data every now and then, has its own keep alive packets or any other mechanism to detect those inactive connections.

See: A 2009 blog post Detection of Half-Open (Dropped) Connections has a list with advantages and disadvantages of this and other methods.

Install

This project can be built with CMake 3.1 and later and a C compiler which is C99 compliant. It uses pthreads and some GNU and/or glibc extensions. Nothing more is required. Don't worry, any non ancient GNU/Linux with GCC should work without problems.

Usage

From your build directory use one of those:

./ideal-waddle -h
sudo ./ideal-waddle
sudo ./ideal-waddle -k

The program uses one (named) thread per client connection. Those “indefinitely consumed resources“ are threads in this program.

Contribute

PRs accepted.

Small note: If editing the Readme, please conform to the standard-readme specification.

License

You can’t perform that action at this time.