13th March 2010
tcpxd - for Cygwin
Richard Kagerer wrote in with Cygwin build
instructions for those who need to use this program on Microsoft
13th September 2005
tcpxd - Another TCP/IP Relay
tcpxd is a general purpose TCP/IP relay program designed to be
simple to get going, requiring only three parameters; the port to
listen on, the host to forward to, and the port on that host to
Having reviewed netcat and other TCP/IP networking code, and
having had a need for a simple and fast relaying proxy, I wrote my
own. It isn't fully finished, but it does work and has elements that
meet my requirements.
The features of this particular relay program are:
The code compiles and runs cleanly on Cygwin (1999), though the
connect() call implementation there appears to not support
asynchronous connections. Despite setting the socket non-blocking
using an fcntl() call the connect() still stalls for the duration of
- accepts connections and forwards them to another host,
- uses TCP_NODELAY to avoid almalgamating X packets,
- can be told to use a specific local port for the forwarded
- can be told to listen only to connections on a specific network
interface (since version 1.1),
- achieves operation of multiple simultaneous connections without
threading or forking,
- performs no buffering; waits for peer to be writeable before
reading from connection,
- has code (unfinished, disabled, but see FAQ) for bandwidth limitation,
- relays a connection closure on one side to the other, but can
still keep the return connection open until the peer closes,
- resolves IP addresses on initialisation rather than on each
- performs the connect() call asynchronously, such that a new
connection does not affect existing connections.
The wishlist for future development is within the single source file.
Contributions and patches are welcome.
Version 1.4 includes changes:
- security vulnerability to crafted reverse DNS names (Jack)
- fix build errors on Solaris 9 Intel (Schonborn)
Note: the program tcpbug in the Debian GNU/Linux package
tcputils is functionally similar to tcpxd. Other
programs in the same package are also quite handy.
Darcs is a distributed revision control system by David Roundy
designed to replace centralised CVS. The source is provided via
darcs to encourage contributions.
|install darcs :
|apt-get install darcs
|checkout initial copy :
|darcs get http://quozl.linux.org.au/darcs/tcpxd
(this creates a directory tcpxd in your current directory)
|propose a change :
(this sends a mail to me with your changes)
(this updates your directory with changes made by me and others)
Can tcpxd be used with inetd?
No, tcpxd does not work with an inetd. There are other
tools that do that. Consider tcpconnect from the Debian
package tcputils, or the netcat program.
How do we do bandwidth limiting?
For example, you might have a line like this in your
inetd.conf file ...
7802 stream tcp nowait.120 nobody /usr/bin/tcpconnect tcpconnect -i 10.0.0.1 7802
This works in a similar manner to ...
... but costs one less process (if you already have inetd),
runs as user "nobody", and has a limit on how many connections can be
accepted each minute. It could also be embedded further with
tcpd for hosts.allow style access control.
The Debian GNU/Linux package trickle contains a program that
can be used with tcpxd to limit bandwidth usage.
| up |