This program sends files to a networked TCP/IP port.

    sffport -s server3 -p 1972 filename
    cat filo | sffport -s localhost -p 3333

Example with an endstring (-B), a long wait (-e 50) and a display of return
    sffport -s -p 40004 -d -B /Nserver -e 50
samples/getSupportedEncodings_Command.xml | cat -vet

Example for testing Multicast with a 10 sec gap between packets of 500 bytes
each, display a dot for each pkt !
    sffport -s -p 6000 -m -d -Y -b 500 -w 10000 tester.180.fip

Any data is passed through without modification unless the the -X flag is set
to add a NUL between CR and NL as telnet zap these.

Note there is an extra FipSeq, \%c for the complete size of file (including

Input Parameters are :
    -s : spider or tty output device        default: none
        unless 'network' or script' parameters are stated.
    -p : spider port number             default: none
        for terminal servers only
    -h : strip the FipHdr               default: no
    -d : display any text from the server       default: no
        Note that if you are looking at this on an
        ordinary window or terminal and control chrs
        are being received, you could screw up your screen.
        Pipe via cat -ve to strip nasties.
        cat file_to_send | sffport -s serv1 -p 1818 -d | cat -ve
    -y : display data as sent           default: no
    -Y : display a dot for each packet as sent  default: no
    -X : add a NUL betweeen CR NL ..        default: no
        so non-transparent telnet does not zap the NL
    -e : At the end, wait for data from the     default: 5
        server. Stop after X secs of no traffic.
    -E : At the end, wait for some data THEN    default: no
        wait '-e' seconds before finishing.
    -T : force the wait at end to be exactly the -e default: no
        ie -T -e 300 will wait for 300 seconds only
    -B : At the end, wait for this string and then  default: no
    -b : block size                 default: 1024
        Use this to test programs which do not handle
        small TCP packet sizes well.
        If you specify more than about 1450, TCP will fragment
        them automatically. The Minimum is 10 bytes.
    -c : Timeout for the connection         default: 60 secs
        for ordinary TCP connections (not multicast or UDP)
    -o : name of an output file for any text from   default: no
        Normally any text is ignored (or displayed with -d)
    -O : also add any data sent to the output file  default: no
        (requires -o (filename) too of course)
    -F : FipAgent for use with ipsvrd       default: no
    -z : Parameter file             default: none
    -S : alternate terminal server if first refuses default: no
    -P : alternate termsvr port if first refuses    default: no
    -R : range of port numbers to use. see below    default: just the one
    -l : log                    default: no
    -L : use SSL layer              default: no
    -I : run Interactively ie run from a shell  default send file
    -A : send the user name on connect to the remote    default: do not
    -u : use UDP as the protocol            default: tcp
    -m : port is multicast              default: tcp
    -M : mTTL                   default: 2
    -H : local IP address for 2nd card for mbone    default: no
    -f : extra FipHdr info for filing in the standing files (-g/-G/-k/-K)   default:
    -g : FipSeq string to send BEFORE the data  default: none
    -G : FipSeq string to send AFTER the data   default: none
    -k : filename of any standing file of FipSeq    default: none
        to send BEFORE the data (and after any -g BEFORE)
    -K : filename of any standing file of FipSeq    default: none
        to send AFTER the data ( and before any -G AFTER)
    -n : once - nstein, twice - squawk box      default: none
    -w : wait in millisecs between sent packets default: 0
        use this to pace a link
    -W : interval in secs between error messages    default: every second
    -x : split string in FipSeq         default: do not split
        the data will be sent in discrete packets starting with this string
    -D : FipSeq to send BEFORE each pkt     default: none
    -v : print version no and exit

For those switches with parameters, the parameter MUST be separated by a space.

-R allows a range of numbers to use. So if we had
    sffport -s humdrum -p 9090 -R 10
then the program will look to the first free port from 9090 to 9099

-- Imitating an HTTPS link - use -L (in this example we also use -I for
    sffportssl -s www.zinglezongle.com -p 443 -L -I
    Then type
        GET / HTTP/1.0
        Host: www.zinglezongle.com
        (2 end of lines)
    ... wait for the reply...

Other env varis can be used to define where the system is :
    SFF_HOME    where the home or top queue is.     default: /fip
            eg  setenv  SFF_HOME    /ripexpress/underware
    SFF_LOG     where the log files queue is        default: (SFF_HOME)/log
    SFF_SPOOL   where the data queues are       default: (SFF_HOME)/spool
    SFF_TMP     where the tmp data queues is        default: (SFF_HOME)/x
            ie if spools are on /data99 which is hard disk /dev/sd0, you MUST also
            have the TMP queue on the same disk/partition

NOTE that for all BUT SFF_HOME, if the parameter starts with a '/' then it is a
hard, absolute path; if not then the spool area is under SFF_HOME.
    eg  setenv  SFF_SPOOL   /data7      will look under /data7 for queues
    while   setenv  SFF_SPOOL   data7       will look under /fip/data7

The Parameter file is use only for FipAgent traffic and is found in
/fip/tables/svrd (not sfftables) :
    ; comment line
    wrapper: xml wrapper string
        eg : wrapper:DEVICE_MESSAGE
        default is FIPAGENT
    data-length: tag containing the length of data following the wrapper
        default is DATALENGTH
    action: Action of the message
        default is REPLY
    message: FipAgent Error Message
        default is MSG
    result: FipAgent result code
        default is RESULT
    device-result: result code from the host process
        default is DEVICE-RESULT
or for SSL stuff
    ssl-method: (1,2,3,23,999)
        Version number to use for TLS/SSL       default: 999 for current default (2 or 3)
    ssl-password: (password)
    ssl-passwd: (password)                default: none
        Optional password if the handshake requires a shared secret
    ssl-cert: (name of a PEM certificate file)      default: none
    ssl-root-cert: (name of a root PEM certificate file)    defaunt: none
        Optional certificates - held in tables/ssl

Version Control
;004v7  05feb02 added mbone
    ;a-c 27jan03 added -I for Interactive stuff
    ;d-g 13feb03 added -A
    ;h 22sep03 added -T
    ;i 05mar04 fipagent restricted to 64k - not now
    ;j 05aug04 added mboneLocalAddress -H
    ;k 05feb05 added WINNT drive letter support for input data file
    ;m 15feb05 added -k/-K for included files
    ;n-p 26mar05 added \%c total filesize including fipHdr
    ;q 30jun05 added -f for extra FipHdr
    ;r-s 25nov05 ssl as -L
    ;t-v7 14sep07 added -l, -g/-G (and -n) plus -B endstring is now
        ;2 ssl modette ;3 added -x splitter ;4 added -D before-pkt ;5 ssl rework ;6
-O added
        ;7 5sep14 reworked progression thru stages (whicho)

(copyright) 2017 and previous years FingerPost Ltd.