TCPTOOLS(1) Basic TCP utilities. DESCRIPTION These three programs provide a poor-man's netcat. tcpclient - connect to a specified host/port and launch a child process. Forward information back and forth between the socket connection and pipes connected to the child. Terminate when the child terminates. tcpserver - Listen on a specified port. For each connection that arrives fork off the specified program to deal with it (in the same way as tcpclient.) tcpforward - Listen on a specified port. For each connection that arrives, create a connection to the destination host/port and ferry the data back and forth. USAGE tcpforward local-port remote-host remote-port tcpclient remote-host remote-port [-q|-Q|-v] command [command options] tcpserver [-q|-Q|-v] local-port command [command-options] local-port: the port to listen on. remote-port: the port to connect to on the remote machine. remote-host: the hostname (or IP address in octet notation) of the machine with which to establish a connection. command: the command to run command-options: what options to pass to the command. VERBOSITY OPTIONS: -q: no output. -Q: errors only (default) -v: debugging output. EXAMPLE A simple echo server may be implemented in bash like so: #!/bin/bash # simple echo server in bash. IFD=7 OFD=6 while read do echo "$REPLY" >&$OFD done <&$IFD To launch this server, do: # tcpserver 7 ./echo-server.sh (remember that 7 is a privelidged port) To listen on port 1337 and forward connections to port 80 on localhost do: $ tcpforward 1337 localhost 80 For an example of using tcpclient, see the bbots/bashbot projects.