crelay - Relay for compressing interactive traffic

Special feature: will flush buffers when no pending data is present. This enables compressing telnet, x-windows, nntp, and other types of "interactive" traffic.


crelay [O|T]  
O               Act as originating relay (compresses)
T               Act as terminating relay (decompresses)
remote-ip       Dotted-quad of remote machine
remote-port     Port to connect to on remote machine

The program is designed to run under inetd


compiler, zlib


g++ -O2 -Wall -o crelay -lz


Let's compress the famous bandwidth-hog: telnet :-)

The originating machine needs to have crelay installed under inetd (otherwise the telnet application would have to be modified) On the originating machine:

  1. Add this to /etc/services:
    ctelnet 23023/tcp
  2. Add this to /etc/inetd.conf (or equivalent):
    ctelnet stream tcp nowait your_username_here /home/your_sername_here/bin/crelay o 23024

This means that when you telnet to crelay will connect to and compress outgoing traffic and decompress ingoing traffic.

The terminating machine also has to have crelay running under inetd.

  1. Add this to /etc/services:
    dtelnet 23024/tcp
  2. Add this to /etc/inetd.conf (or equivalent):
    dtelnet stream tcp nowait your_username_here /home/your_sername_here/bin/crelay t 23

This means that crelay will connect to to (local telnet) and decompress ingoing traffic and compress outgoing.

Now test it with:

  telnet 23023


zlib is quite good and you will rarely see in in "top".

The compression ratio varies with the protocol. Normal telnet traffic will not compress much, and besides normal modems are really good at compressing that part already.

For NNTP traffic can usually be compressed 30-60%

X/Windows traffic can on the average be compressed to 13% which is quite good. In one pathetic application I have seen the traffic be compressed to a 80th of the original.


here: (5KB)