netpipes

Hurricane Electric Internet Services: Accounts starting at $9.95/month
Hurricane Electric Internet Services

NAME

       netpipes - a package to manipulate BSD TCP/IP stream sock-
       ets


SYNOPSIS

       faucet  port   (-in|-out|-err|-fdn)   [-once]   [-verbose]
       [-quiet]  [-unix]  [-foreignhost addr] [-foreignport port]
       [-localhost addr] [-daemon] [-shutdown (r|w)  ]  [-serial]
       [-pidfile                                        filename]
       [-[i][o][e][#3[,4[,5...]]][v][1][q][u][d][s]] [-p foreign-
       port] [-h foreign-host] [-H local-host] command args

       hose  hostname port (-in|-out|-err|-fdn|-slave) [-verbose]
       [-unix] [-localport port]  [-localhost  addr]  [-retry  n]
       [-delay        n]        [-shutdown       [r|w][a]       ]
       [-[i][o][e][#3[,4[,5...]]][s][v][u]] [-p  local-port]  [-h
       local-host] command args

       sockdown [fd [how] ]

       getpeername [ -verbose ] [ -sock ] [ fd ]

       getsockname [ -verbose ] [ -peer ] [ fd ]



DESCRIPTION

         The  netpipes  package  makes  TCP/IP  streams usable in
       shell scripts.  It can also simplify client/server code by
       allowing  the  programmer to skip all the tedious program-
       ming bits related to sockets and concentrate on writing  a
       filter/service.

         faucet is the server end of a TCP/IP stream.  It listens
       on a port of the local machine  waiting  for  connections.
       Every time it gets a connection it forks a process to per-
       form a service for the connecting client.

         hose is the client end of a TCP/IP stream.  It  actively
       connects to a remote port and execs a process to request a
       service.

         sockdown is a simple program designed to shut down  part
       or  all  of the socket connection.  It is primarily useful
       when the processes connected to the  socket  perform  both
       input and output.

         getpeername  and getsockname are two names for a program
       designed to print out the  addresses  of  the  ends  of  a
       socket.   getpeername prints the address of the remote end
       and getsockname prints the address of the local end.





EXAMPLES

       Here is a simple  command  I  often  perform  to  transfer
       directory  trees  between  machines.   (rsh  does not work
       because one machine is connected using  SLIP  and  .rhosts
       are out of the question).
              server$ faucet 3000 -out tar cf - .
              client$ hose server 3000 -in tar xvf -

       Here is a minimal HTTP client.  It is so minimal it speaks
       old HTTP.
              cairo$ hose www.cis.ufl.edu 80 -in -out \
                   sh -c "(echo 'GET /'; sockdown) & cat > result"

       And of course, there is Nick Trown's metaserver for Netrek
              cairo$ hose metaserver.ecst.csuchico.edu 3521 -in cat

       Finally,  allow me to apologize ahead of time for the con-
       volutedness of the  following  example.   It  requires  an
       understanding  of Bourne shell file descriptor redirection
       syntax (and illustrates why csh and tcsh suck  eggs).   Do
       not  try  to type this from your tcsh command line.  Get a
       bash (GNU's Bourne Again SHell).
              server$ faucet 3000 -in -out -verbose enscript -2rGhp -
              client$ ps aux | hose server 3000 -in -out \
                   sh -c " (cat <&3; sockdown ) & cat >&4 " 3<&0 4>&1 | \
                   lpr -Pps422
       This proves that hose can be used as part of a pipeline to
       perform  a sort of remote procedure call (RPC).  After you
       have figured out that example, you will know  how  to  use
       Bourne  shell to shuffle file descriptors around.  It is a
       handy skill.

       Now we go to the extreme, but simplify things by using the
       -slave option of hose.  The following is a socket relay
              gateway$ faucet 3000 -in -out \
                   sh -c "hose server 4000 -slave "
       It's a handy little bugger when you want to tunnel through
       a firewall on an occasional basis.



SEE ALSO

       faucet(1), hose(1), sockdown(1), getpeername(1),



COPYRIGHT

       Copyright (C) 1995 Robert Forsman

       This program is free software;  you  can  redistribute  it
       and/or modify it under the terms of the GNU General Public
       License as published  by  the  Free  Software  Foundation;
       either  version  2 of the License, or (at your option) any
       later version.

       This program is distributed in the hope that  it  will  be
       useful, but WITHOUT ANY WARRANTY; without even the implied
       warranty of MERCHANTABILITY or FITNESS  FOR  A  PARTICULAR
       PURPOSE.   See  the  GNU  General  Public License for more
       details.

       You should have received a copy of the GNU General  Public
       License along with this program; if not, write to the Free
       Software Foundation, Inc., 675  Mass  Ave,  Cambridge,  MA
       02139, USA.



AUTHOR

        Robert Forsman
        thoth@cis.ufl.edu
        Purple Frog Software
        http://www.purplefrog.com/~thoth/
Hurricane Electric Internet Services: Accounts starting at $9.95/month
Hurricane Electric Internet Services
Copyright (C) 1998 Hurricane Electric. All Rights Reserved.