



                           FTP Client Engine

                           Library for Delphi


                                (FCE4D)


                           REFERENCE MANUAL



                              Version 1.2

                           September 29, 1999




                     This software is provided as-is.
              There are no warranties, expressed or implied.




                           Copyright (C) 1999
                           All rights reserved



                       MarshallSoft Computing, Inc.
                           Post Office Box 4543
                           Huntsville AL 35815


                           Voice : 256-881-4630
                             FAX : 256-880-0925
                           email : info@marshallsoft.com
                             web : www.marshallsoft.com

                               _______
                          ____|__     |                (R)
                       --+       |    +-------------------
                         |   ____|__  |  Association of
                         |  |       |_|  Shareware
                         |__|   o   |    Professionals
                       --+--+   |   +---------------------
                            |___|___|    MEMBER


      MARSHALLSOFT is a registered trademark of MarshallSoft Computing.




     FCE4D Reference Manual                                    Page 1

                            C O N T E N T S



        Chapter                                     Page

        Table of Contents.............................2

        General Remarks...............................3

           The FCE.PAS Unit...........................3
           The FCEW.PAS Unit..........................3

        FCE Functions.................................4

           fceAbort...................................4
           fceAttach..................................5
           fceClose...................................6
           fceCommand.................................7
           fceConnect.................................8
           fceDelFile.................................9
           fceDelServerDir...........................10
           fceDriver.................................11
           fceErrorText..............................12
           fceExtract................................13
           fceGetFile................................14
           fceGetInteger.............................15
           fceGetList................................16
           fceGetLocalDir............................17
           fceGetServerDir...........................18
           fceGetString..............................19
           fceMakeServerDir..........................20
           fcePutFile................................21
           fceRelease................................22
           fceSetInteger.............................23
           fceSetLocalDir............................25
           fceSetMode................................26
           fceSetServerDir...........................27
           fceSetString..............................28



















     FCE4D Reference Manual                                    Page 2

      General Remarks

      All functions return an integer code. Negative values are always
      errors. See Section 13.3 "FCE Error Return Code List" in the FCE
      Users Manual (FCE4D_U.TXT). Non-negative return codes are never
      errors.

      Note than Delphi 1 limits strings to 255 characters. This limitation
      is removed in Delphi 2 and above.

      Note that the examples in this manual use the 'DISPLAYU.PAS' unit for
      displaying text on the screen.

      There are two units than can be used to call FCE functions. The first
      is FCE.PAS (created from FCE16.PAS or FCE32.PAS by INSTALL) and is
      used by all example programs other than FTPW_PGM.PAS. The second unit
      is the FCEW.PAS unit ("wrapped FCE"), which makes calls to FCE.PAS.
      The FCEW unit is used by FTPW_PGM.PAS.

      The FCE.PAS Unit

      The functions in the FCE.PAS unit make calls directly to FCE16.DLL or
      FCE32.DLL. Note the manner in which strings are passed to FCE
      functions.

         var Ptr : PChar;

         begin
           {allocate Memory (128 bytes) and copy string to it}
           GetMem(Ptr, 128); StrPCopy(Ptr, 'This is a string');
           {pass Ptr to FCE function}
           Code := fceXXXXX(...,Ptr,...);
           {free Memory}
           FreeMem(Ptr, 128);

      All of the functions in this manual use the FCE.PAS unit.

      The FCEW.PAS Unit

      The functions in the FCEW.PAS unit ("wrapped FCE") call the functions
      in the FCE.PAS unit. Normal Delphi strings are passed to all
      functions in this unit, rather than PChar pointers, as in the FCE.PAS
      unit.

      The FCEW.PAS unit is easier to use than the FCE.PAS unit because
      Delphi strings can be passed directly. The FCEW_PGM.PAS example
      program uses the FCEW.PAS unit.











     FCE4D Reference Manual                                    Page 3

      +----------+--------------------------------------------------------+
      | fceAbort | Abort file fceDriver.                                  |
      +----------+--------------------------------------------------------+


        SYNTAX  function fceAbort(
                     Channel : Integer)  {channel number}
                  : Integer;

       REMARKS  The fceAbort function is used to abort the FCE state
                driver. This is used when calling the FCE state driver
                (fceDriver) directly and it is neccessary to abort.

                After calling fceAbort, subsequent calls to fceDriver will
                return 0 (IDLE). Thus, FCE is ready for the next command.

                This function is not required unless the state driver
                fceDriver is being called directly.

       RETURNS  < 0 : An error has occurred. Call fceErrorText.

       EXAMPLE

                 {abort driver}
                 Code := fceAbort(0)

      ALSO SEE fceDriver































     FCE4D Reference Manual                                    Page 4

      +-----------+-------------------------------------------------------+
      | fceAttach | Initializes FCE.                                      |
      +-----------+-------------------------------------------------------+


        SYNTAX  function fceAttach(
                    NbrChans : Integer;  {Number of channels or threads}
                    KeyCode  : Integer)  {Registration key code}
                  : Integer;

       REMARKS  The fceAttach function must be the first FCE call made.
                Pass the maximum number of channels or threads that will be
                in use. Use NbrChans = 1 for non-threaded applications.

                The 'Channel' parameter for subsequent calls to FCE
                functions must be in the range of 0 to NbrChans-1.

                In WIN32, up to 32 threads (numbered from 0 to 31) can be
                started, each of which can be connected to a different FTP
                server and run independently.

                When FCE is registered, you will receive a 'KeyCode' which
                matches the 'KeyCode' within the registered DLL. For the
                shareware version, the keycode is 0. See KEYCODE.PAS.

       RETURNS  < 0 : An error has occurred. Call fceErrorText.

       EXAMPLE

                {Initialize FCE (look in KEYCODE.PAS for FCE_KEY_CODE)}
                Code := fceAttach(1, FCE_KEY_CODE);

                {call any FCE function except fceAttach and fceRelease}
                {Pass 0 as the channel number}

                {Terminate FCE}
                Code := fceRelease;

      ALSO SEE fceRelease.



















     FCE4D Reference Manual                                    Page 5

      +----------+--------------------------------------------------------+
      | fceClose | Closes connection opened by fceConnect.                |
      +----------+--------------------------------------------------------+


        SYNTAX  function fceClose(
                    Channel : Integer)   {channel number}
                  : Integer;

       REMARKS  The fceClose function closes the connection to the FTP
                server opened with fceConnect. After closing, another
                connection on channel 'Chan' may be opened with fceConnect.

                If fceConnect fails, do NOT call fceClose.

       RETURNS  < 0 : An error has occurred. Call fceErrorText.

       EXAMPLE

                {Connect to FTP server}
                Code := fceConnect(0,...);

                {...List, delete, upload, and download files}

                {close connection}
                Code := fceClose(0);

      ALSO SEE fceConnect.






























     FCE4D Reference Manual                                    Page 6

      +------------+------------------------------------------------------+
      | fceCommand | Sends user specified command to the server.          |
      +------------+------------------------------------------------------+


        SYNTAX  function fceCommand(
                    Channel : Integer;   {channel number}
                    Command : PChar)     {user command}
                  : Integer;

       REMARKS  The fceCommand function is used to send an arbitrary user
                command to the FTP server. This is typically used with FTP
                servers that require an additional level of user
                authenication.

       RETURNS  < 0 : An error has occurred. Call fceErrorText.

       EXAMPLE

                var
                  Code    : Integer;
                  CmdPtr  : PChar;
                  CmdText : String;

                begin
                  {assume already connected to FTP server}
                  CmdText := 'secondpassword';
                  GetMem(CmdPtr, 50);
                  StrPCopy(CmdPtr, CmdText);
                  Code := fceCommand(0, CmdPtr);
                  FreeMem(CmdPtr, 50);
                  if Code >= 0 then {command accepted}
                  else {command NOT accepted}

      ALSO SEE fceConnect.























     FCE4D Reference Manual                                    Page 7

      +------------+------------------------------------------------------+
      | fceConnect | Connects to a FTP server.                            |
      +------------+------------------------------------------------------+


        SYNTAX  function fceConnect(
                    Channel : Integer;   {Channel number}
                    Server  : PChar;     {Server name or dotted IP addr}
                    User    : PChar;     {Users account or 'anonymous'}
                    Pass    : PChar)     {Password for above}
                  : Integer;

       REMARKS  The fceConnect function connects to the FTP server
                'Server'and logs on as 'User'with password 'Pass'.

                FTP servers that allow anonymous access will accept "ftp"
                or "anonymous" for the user name and your email address for
                the password.

       RETURNS  < 0 : An error has occurred. Call fceErrorText.

       EXAMPLE

               var
                 Code : Integer;
                 Host, User, Pass : PChar;

               {attach FCE}
               Code := fceAttach(1, FCE_KEY_CODE)
               if Code < 0 then
                 begin
                   {Error connecting}
                   exit
                 end
               {connect to server}
               GetMem(Host,64); StrPCopy(Host,'ftp.marshallsoft.com');
               GetMem(User,64); StrPCopy(User,'anonymous');
               GetMem(Pass,64); StrPCopy(Pass,'msc@traveller.com');
               Code := fceConnect(0, Host, User, Pass);
               FreeMem(Host, 64); FreeMem(User, 64); FreeMem(Pass, 64);
               if Code < 0 then
                 begin
                   DisplayError(Memo, Code);
                   exit
                 end;

      ALSO SEE fceClose.











     FCE4D Reference Manual                                    Page 8

      +------------+------------------------------------------------------+
      | fceDelFile | Deletes file from the FTP server.                    |
      +------------+------------------------------------------------------+


        SYNTAX  function fceDelFile(
                    Channel  : Integer;  {channel number}
                    FileName : PChar)    {Name of file to delete}
                  : Integer;

       REMARKS  The fceDelFile function is used to delete the file
                'FileName' from the FTP server.

                The delete may fail if either you don't have the necessary
                permission (as is typical when you connect as an anonymous
                user) or the file itself is marked as read-only.

       RETURNS  < 0 : An error has occurred. Call fceErrorText.

       EXAMPLE

                var
                  Code : Integer;
                  Server, User, Pass : PChar;

                {Attach FCE}
                Code := fceAttach(1, FCE_KEY_CODE)
                ...
                {Connect to FTP server}
                Code := fceConnect(0,Server,User,Pass);
                ...
                {delete file}
                GetMem(Ptr, 64);
                StrPCopy(Ptr,'products.txt');
                Code := fceDelFile(0, Ptr);
                FreeMem(Ptr, 64);
                if Code >= 0 then
                  DisplayLine(Memo,'File deleted');
                else
                  DisplayLine(Memo,'File NOT deleted');
                {close connection}
                Code := fceClose(0);
                {release FCE}
                Code := fceRelease;

      ALSO SEE fcePutFile and fceDelServerDir












     FCE4D Reference Manual                                    Page 9

      +-----------------+-------------------------------------------------+
      | fceDelServerDir | Deletes the server directory.                   |
      +-----------------+-------------------------------------------------+


        SYNTAX  function fceDelServerDir(
                    Channel : Integer;   {channel number}
                    DirName : PChar)     {Name of directory to delete}
                  : Integer;

       REMARKS  The fceDelServerDir function is used to delete the server
                directory 'DirName' from the FTP server.

                The delete may fail if you don't have the necessary
                permission, as is typical when you connect as an anonymous
                user.

       RETURNS  < 0 : An error has occurred. Call fceErrorText.

       EXAMPLE

                var
                  Code : Integer;
                  Ptr  : PChar;

                {delete server directory 'mystuff.dir'}
                GetMem(Ptr,64); StrPCopy(Ptr,'mystuff.dir');
                Code := fceDelServerDir(0, Ptr);
                FreeMem(Ptr, 64);
                If Code < 0 then
                  begin
                    DisplayError(Memo, Code);
                    exit;
                  end;
                {close connection}
                Code := fceClose(0);
                {release FCE}
                Code := fceRelease;

      ALSO SEE fceDelFile


















     FCE4D Reference Manual                                    Page 10

      +-----------+-------------------------------------------------------+
      | fceDriver | Executes the next state in the FCE state engine.      |
      +-----------+-------------------------------------------------------+


        SYNTAX  function fceDriver(
                    Channel : Integer)   {Channel}
                  : Integer;

       REMARKS  The fceDriver function executes the next state in the FCE
                state engine.

                This function is only used when FCE_AUTO_CALL_DRIVER is set
                to 0.

                Refer to Section 4.0, "Theory of Operation" in the FCE
                Users Manual (FCE4D_U.TXT) for more details.

       RETURNS  < 0 : An error has occurred. Call fceErrorText.

       EXAMPLE

                var
                  Code : Integer;
                  Ptr  : PChar;

                {Attach FCE}
                Code := fceAttach(1, FCE_KEY_CODE)
                {Connect to FTP server}
                Code := fceConnect(0, ...);
                {turn AUTO CALL off}
                Code := fceSetInteger(0,FCE_SET_AUTO_CALL_DRIVER, 0);
                {ask for file}
                Code := fceGetFile(0, Ptr);
                if Code < 0 then
                  begin
                    DisplayError(Memo, Code);
                    exit
                  end;
                {call the driver until it returns 0}
                while fceDriver(0) <> 0 do
                  begin
                    {print dot for each call to driver}
                    DisplayLine(Memo,'.');
                  end;
                {turn AUTO CALL back on}
                Code := fceSetInteger(0,FCE_SET_AUTO_CALL_DRIVER, 1);
                {close connection}
                Code := fceClose(0);
                {release FCE}
                Code := fceRelease;

      ALSO SEE "Theory of Operation" in the Users Manual (FCE4D_U.TXT).





     FCE4D Reference Manual                                    Page 11

      +--------------+----------------------------------------------------+
      | fceErrorText | Formats an error message.                          |
      +--------------+----------------------------------------------------+


        SYNTAX  function fceErrorText(
                    Channel: Integer;    {channel number}
                    Code   : Integer;    {Error code}
                    Buffer : PChar;      {location to put error message}
                    BufLen : Integer)    {size of above}
                  : Integer;

       REMARKS  The fceErrorText function formats the error message for
                error 'Code' in 'Buffer'.

                Call this function when an error (a negative value) is
                returned from a FCE function so that the error message can
                be displayed or logged.

       RETURNS  The number of characters copied to 'Buffer'.

       EXAMPLE

                procedure DisplayError(Memo: TMemo; Code : Integer);
                var
                  Text : String;
                  Ptr  : PChar;
                begin
                  if Code < 0 then
                    begin
                      GetMem(Ptr, 120);
                      Code := fceErrorText(0,Code, Ptr, 120);
                      DisplayLine(Memo,StrPas(Ptr));
                      Text := Format(' FCE error %d.',[Code]);
                      FreeMem(Ptr,120);
                      DisplayLine(Memo,Text);
                    end
                  end;

      ALSO SEE


















     FCE4D Reference Manual                                    Page 12

      +------------+------------------------------------------------------+
      | fceExtract | Extracts strings from FTP formatted file list.       |
      +------------+------------------------------------------------------+


        SYNTAX  function fceExtract(
                    Buffer   : PChar;    {buffer returned by fceGetList}
                    LineNbr  : PChar;    {line number [1,2,...] wanted}
                    FieldNbr : PChar;    {field number [1,2,...] wanted}
                    BufPtr   : PChar;    {Resultant buffer}
                    BufLen   : Integer)  {Size of above}
                  : Integer;

       REMARKS  The fceExtract function extracts fields from FTP formatted
                file lists for line 'LineNbr' and field 'FieldNbr'. The
                extracted substring is copied into 'BufPtr'. Use 'FieldNbr'
                0 in order to copy the entire line rather than a field.

                A typical line in a full FTP directory listing may look
                like the following. Note that there are 9 fields.

                -rw-r--r-- 1 345 15 100424 Feb 8 16:26 fce4c10b.zip

                Note that in the line above, field 5 is the file length.

                The fceExtract function is typically called after calling
                fceGetList.

       RETURNS The number of characters copied to 'BufPtr'.

       EXAMPLE

                var
                  DataPtr : PChar;
                  LinePtr : PChar;

                {ask for full list}
                GetMem(DataPtr, 5000); GetMem(LinePtr, 150);
                Code := fceGetList(0,FCE_FULL_LIST,DataPtr,5000);
                if Code < 0 then
                  begin
                    DisplayError(Memo, Code)
                    exit
                  end;
                {get each field for line 8}
                Line := 8
                for I := 1 to 9 do
                  begin
                    Code := fceExtract(DataPtr,Line,I,LinePtr, 150);
                    DisplayLine(Memo,LineBuf)
                  end;

      ALSO SEE fceGetList





     FCE4D Reference Manual                                    Page 13

      +------------+------------------------------------------------------+
      | fceGetFile | Gets (downloads) file from FTP server.               |
      +------------+------------------------------------------------------+


        SYNTAX  function fceGetFile(
                    Channel  : Integer;  {channel number}
                    FileName : PChar)    {Name of file to download}
                  : Integer;

       REMARKS  The fceGetFile function is used to download the file
                {'FileName' from the FTP server}

                Note that ASCII transfer mode is normally the default. Call
                fceSetMode(Chan, 'B') to set the transfer mode to binary
                for non ASCII files.

       RETURNS  < 0 : An error has occurred. Call fceErrorText.

       EXAMPLE

                var
                  Code : Integer;
                  Ptr  : PChar;

                {delete file 'mystuff.pas'}
                GetMem(Ptr,64); StrPCopy(Ptr,'mystuff.pas');
                Code := fceDelFile(0, Ptr);
                FreeMem(Ptr, 64);
                If Code < 0 then
                  begin
                    DisplayError(Memo, Code);
                    exit;
                  end;
                {close connection}
                Code := fceClose(0);
                {release FCE}
                Code := fceRelease;


      ALSO SEE fcePutFile

















     FCE4D Reference Manual                                    Page 14

      +---------------+---------------------------------------------------+
      | fceGetInteger | Returns numeric parameter.                        |
      +---------------+---------------------------------------------------+


        SYNTAX  function fceGetInteger(
                    Channel   : Integer; {channel number}
                    ParamName : Integer) {Parameter name}
                  : LongInt;

       REMARKS  The fceGetInteger function returns the value of the
                specified parameter 'ParamName'.

                Note that the return type is unsigned long.

                FCE_GET_VERSION : Returns FCE version.
                FCE_GET_BUILD : Returns FCE build number.
                FCE_GET_SOCK_ERROR : Returns last socket error code.
                FCE_GET_SOCKET : Returns control socket number.
                FCE_GET_COUNTER : Returns # times FCE driver was called.
                FCE_GET_RESPONSE : Returns last FTP response.
                FCE_GET_FILE_BYTES_RCVD : Returns # file bytes received.
                FCE_GET_TOTAL_BYTES_RCVD : Returns total bytes received.
                FCE_GET_FILE_BYTES_SENT : Returns # file bytes sent.
                FCE_GET_TOTAL_BYTES_SENT : Returns total file bytes sent.
                FCE_GET_CONNECT_STATUS : Returns 1 if connected.

       RETURNS  Value of parameter requested.

       EXAMPLE

                {display FCE version number}

                Dim Version As Integer
                Dim S1, S2 : PChar;

                Version := fceGetInteger(0, FCE_GET_VERSION)

                S1 := Hex$(Version)
                S2 := Mid$(S2, 1, 1) + '.' + Mid$(S2, 2, 1) + '.'
                     + Mid$(S2, 3, 1)
                Print 'FCE4D version ' + S2

      ALSO SEE fceGetString














     FCE4D Reference Manual                                    Page 15

      +------------+------------------------------------------------------+
      | fceGetList | Gets file list from FTP server.                      |
      +------------+------------------------------------------------------+


        SYNTAX  function fceGetList(
                    Channel : Integer;   {channel number}
                    Flag    : Integer;   {FULL or NAME list flag}
                    Buffer  : PChar;     {List buffer}
                    BufLen  : Integer)   {size of 'Buffer'}
                  : Integer;

       REMARKS  The fceGetList function downloads the directory list from
                the FTP server.

                If 'FCE_FULL_LIST' is passed for 'Flag', a full directory
                listing is returned in 'Buffer'. Note that the exact format
                of the list depends on the particular FTP server.

                If 'FCE_NAME_LIST' is passed for 'Flag', a listing is
                returned consisting of file names only. Note that some FTP
                servers do not support the name list function.

                If 'FCE_FULL_LIST_FILE' is passed for 'Flag', the filename
                to list is taken from 'Buffer'. If the file exists, a
                listing of this file is returned.

                If 'FCE_NAME_FULL_LIST_FILE' is passed for 'Flag', the
                filename to list is taken from 'Buffer'. If the file
                exists, the name of this file is returned. Be sure to
                check the return code length.

                File lists consist of a zero terminated list of file
                entries, each of which is terminated by a carriage return,
                line feed pair. Also check the return code, which contains
                the length of the characters placed in 'Buffer'.

       RETURNS  < 0 : An error has occurred. Call fceErrorText.
               >= 0 : Number of characters copied to 'Buffer'.

       EXAMPLE

                var
                  Buffer : PChar;
                ...
                {get file name list}
                GetMem(Buffer, 5000);
                Code := fceGetList(0,FCE_LIST_NAME,Buffer,5000)
                if Code > 0 then
                  DisplayLine(Memo,Buffer);
                else
                  DisplayLine(Memo,'Not found.');
                end;

      ALSO SEE  fceExtract.



     FCE4D Reference Manual                                    Page 16

      +----------------+--------------------------------------------------+
      | fceGetLocalDir | Returns the local upload/download directory.     |
      +----------------+--------------------------------------------------+


        SYNTAX  function fceGetLocalDir(
                    Channel : Integer;   {channel number}
                    Buffer  : PChar;     {string buffer}
                    BufLen  : Integer)   {size of 'Buffer'}
                  : Integer;

       REMARKS  The fceGetLocalDir function returns the local
                upload/download directory.

                The local upload/download directory is the directory used
                for all uploads and downloads. The default is the current
                directory ('.').

                Both relative and absolute directories may be specified.

       RETURNS  < 0 : An error has occurred. Call fceErrorText.
               >= 0 : The number of characters copied.

       EXAMPLE

               {Set local upload/download directory}

               var
                 Ptr : PChar;

               GetMem(Ptr, 64);
               StrPCopy(Ptr, 'downloads/text');
               Code := fceSetLocalDir(0, Ptr);
               FreeMem(Ptr);

      ALSO SEE fceSetLocalDir






















     FCE4D Reference Manual                                    Page 17

      +-----------------+-------------------------------------------------+
      | fceGetServerDir | Returns the FTP server directory.               |
      +-----------------+-------------------------------------------------+


        SYNTAX  function fceGetServerDir(
                    Channel: Integer;      {channel number}
                    Buffer : PChar;        {string buffer}
                    BufLen : Integer)      {size of 'Buffer'}
                  : Integer;

       REMARKS  The fceGetServerDir function returns the FTP server
                directory.

                Note that most all FTP servers will restrict clients as to
                which directories on the server that can be accessed.

                The default is the current logged directory on the FTP
                server.

       RETURNS  < 0 : An error has occurred. Call fceErrorText.
               >= 0 : The number of characters copied.

       EXAMPLE

               var
                 Ptr : PChar;

               GetMem(Ptr, 64);
               Code := fceGetServerDir(0, Ptr, 64);
               DisplayString(Memo, 'Server directory is ');
               DisplayLine(Memo, StrPas(Ptr) );

      ALSO SEE  fceSetServerDir
























     FCE4D Reference Manual                                    Page 18

      +------------------+------------------------------------------------+
      | fceMakeServerDir | Creates server directory.                      |
      +------------------+------------------------------------------------+


        SYNTAX  function fceMakeServerDir(
                    Channel : Integer;   {channel number}
                    DirName : PChar)     {Name of directory to make}
                  : Integer;

       REMARKS  The fceMakeServerDir function is used to make (create)
                server directory 'DirName' on the FTP server.

                The make may fail if you don't have the necessary
                permission, as is typical when you connect as an anonymous
                user.

       RETURNS  < 0 : An error has occurred. Call fceErrorText.

       EXAMPLE

                var
                  Ptr : PChar;

                GetMem(Ptr, 64);
                StrPCopy(Ptr, 'mystuff.dir');
                {create new directory}
                Code := fceMakeServerDir(0, Ptr);
                FreeMem(Ptr, 64);

      ALSO SEE fceDelServerDir



























     FCE4D Reference Manual                                    Page 19

      +--------------+----------------------------------------------------+
      | fceGetString | Returns string parameter.                          |
      +--------------+----------------------------------------------------+


        SYNTAX  function fceGetString(
                    Channel   : Integer; {channel number}
                    ParamName : PChar;   {parameter name}
                    Buffer    : PChar;   {string buffer}
                    BufLen    : PChar)   {size of 'Buffer'}
                  : Integer;

       REMARKS  The fceGetString function returns the string parameter
                'ParamName'.

                FCE_GET_REGISTRATION : Returns registration string.
                FCE_GET_LAST_RESPONSE : Returns last FTP response.
                FCE_GET_SERVER_IP : Returns IP address of FTP server.

       RETURNS  < 0 : An error has occurred. Call fceErrorText.
               >= 0 : Number of characters copied to 'Buffer'.

       EXAMPLE

               var
                 Ptr : PChar;

               GetMem(Ptr, 50);
               {display registration string within the DLL}
               Code := fceGetString(0,FCE_GET_REGISTRATION,Ptr,50);
               DisplayString(Memo, 'Registration = ');
               DisplayLine(Memo, StrPas(Ptr) );

               {display server IP address in dotted format}
               Code := fceGetString(0,FCE_GET_SERVER_IP,Ptr,20);
               DisplayString(Memo, 'Server IP address := ');
               DisplayLine(Memo, StrPas(Ptr) );

               FreeMem(Ptr, 50);

      ALSO SEE fceGetInteger

















     FCE4D Reference Manual                                    Page 20

      +------------+------------------------------------------------------+
      | fcePutFile | Uploads file to FTP server.                          |
      +------------+------------------------------------------------------+


        SYNTAX  function fcePutFile(
                    Channel  : Integer;  {channel number}
                    FileName : PChar)    {name of file to upload}
                  : Integer;

       REMARKS  The fcePutFile function uploads the file 'FileName' to the
                FTP server.

                The file 'FileName' to be uploaded must be in the local
                upload/download directory.

       RETURNS  < 0 : An error has occurred. Call fceErrorText.

       EXAMPLE

               var
                  Code : Integer;
                  Ptr  : PChar;

                {upload file 'mystuff.pas'}
                GetMem(Ptr,64); StrPCopy(Ptr,'mystuff.pas');
                Code := fcePutFile(0, Ptr);
                FreeMem(Ptr, 64);
                If Code < 0 then
                  begin
                    DisplayError(Memo, Code);
                    exit;
                  end;
                {close connection}
                Code := fceClose(0);
                {release FCE}
                Code := fceRelease;

      ALSO SEE fceGetFile.



















     FCE4D Reference Manual                                    Page 21

      +------------+------------------------------------------------------+
      | fceRelease | Releases FCE.                                        |
      +------------+------------------------------------------------------+


        SYNTAX  function fceRelease
                  : Integer;

       REMARKS  The fceRelease function releases the FCE system. This
                should be the very last function called.

                fceClose should be called for all channels before calling
                fceRelease.

       RETURNS  < 0 : An error has occurred. Call fceErrorText.

       EXAMPLE

                {Initialize FCE}
                Code := fceAttach(1, FCE_KEY_CODE);

                {call FCE functions except fceAttach and fceRelease}

                {Terminate FCE}
                Code := fceRelease;

      ALSO SEE fceAttach.































     FCE4D Reference Manual                                    Page 22

      +---------------+---------------------------------------------------+
      | fceSetInteger | Sets numeric parameter.                           |
      +---------------+---------------------------------------------------+


        SYNTAX  function fceSetInteger(
                    Channel   : Integer; {channel number}
                    ParamName : Integer; {parameter name}
                    ParamValue: Integer) {parameter value}
                  : Integer;

       REMARKS  The fceSetInteger function sets the numeric parameter
                'ParamName' to the value 'ParamValue'.

                        Parameter Name      Default

                FCE_SET_MIN_RESPONSE_WAIT : 0
                FCE_SET_MAX_RESPONSE_WAIT : 10000
                     FCE_SET_CONNECT_WAIT : 60000
                    FCE_SET_MIN_LINE_WAIT : 0
                    FCE_SET_MAX_LINE_WAIT : 20000
                  FCE_SET_MAX_LISTEN_WAIT : 20000
                 FCE_SET_AUTO_CALL_DRIVER : 1
                       FCE_SET_SLEEP_TIME : 20 (WIN32 only)
                         FCE_SET_FTP_PORT : 21
                     FCE_SET_CLOSE_LINGER : 50 (WIN32) or 500 (WIN16)
                    FCE_SET_WRITE_BUFSIZE : 512 (WIN16) or 1024 (WIN32)
                          FCE_SET_PASSIVE : 0

                FCE_SET_MIN_RESPONSE_WAIT is the delay before looking for
                the server's response.

                FCE_SET_MAX_RESPONSE_WAIT is the time after which a
                "time-out" error occurs if the server has not responded.

                FCE_SET_MIN_LINE_WAIT is the delay before checking if the
                server is ready to accept the next line of input.

                FCE_SET_MAX_LINE_WAIT is the time after which a "time-out"
                error is declared if the server has not responded.

                FCE_SET_CONNECT_WAIT is the maximum time allowed to
                complete a connection to the SMTP server.

                FCE_SET_MAX_LISTEN_WAIT is the maximum time allowed to wait
                for an initial response from the server for incoming data.












     FCE4D Reference Manual                                    Page 23

                FCE_SET_SLEEP_TIME is the sleep time (in milliseconds) when
                waiting for socket I/O to complete. Usefull in
                multi-threaded environments.

                FCE_SET_FTP_PORT is the port number to use when connecting
                to the FTP server. The default is the well-known port
                number 21.

                FCE_SET_CLOSE_LINGER is the "linger" time after an upload
                is completed before closing the data socket. Setting this
                value too small (at least in WIN16) causes the data socket
                to be closed before the last block of data is transmitted.

                FCE_SET_WRITE_BUFSIZE is the transmit block size. The
                maximum value is 4096 for WIN16 and 8192 for WIN32.

                FCE_SET_PASSIVE sets passive mode on (1) and off (0).

       RETURNS  < 0 : An error has occurred. Call fceErrorText.

       EXAMPLE

                {disable the automatic calling of the state driver}
                Code := fceSetInteger(0, FCE_SET_AUTO_CALL_DRIVER, 0);

                {set the write buffer size to 2048}
                Code := fceSetInteger(0, FCE_SET_WRITE_BUFSIZE, 2048);

                {set the WIN32 sleep time to 100 mS}
                Code := fceSetInteger(0, FCE_SET_SLEEP_TIME, 100);

      ALSO SEE fceSetString


























     FCE4D Reference Manual                                    Page 24

      +----------------+--------------------------------------------------+
      | fceSetLocalDir | Sets the local upload/download directory.        |
      +----------------+--------------------------------------------------+


        SYNTAX  function fceSetLocalDir(
                    Channel : Integer;   {channel number}
                    DirName : PChar)     {local directory path}
                  : Integer;

       REMARKS  The fceSetLocalDir function sets the local computer upload
                and download directories. The upload and download
                directory is the directory used by FCE for all uploads and
                downloads.

       RETURNS  < 0 : An error has occurred. Call fceErrorText.

       EXAMPLE

                var
                  Ptr : PChar;

                {specify the local upload/download directory}

                GetMem(Ptr, 50);
                StrPCopy(Ptr, 'C:\TEMP');
                Code := fceSetLocalDir(0, Ptr);
                FreeMem(Ptr, 50);

                {all upload and download requests will now}
                {use directory C:\TEMP}

      ALSO SEE fceGetLocalDir

























     FCE4D Reference Manual                                    Page 25

      +------------+------------------------------------------------------+
      | fceSetMode | Sets FTP transfer mode.                              |
      +------------+------------------------------------------------------+


        SYNTAX  function fceSetMode(
                    Channel : Integer;   {channel number}
                    Mode    : Integer)   {transfer mode ('A' or 'B')}
                  : Integer;

       REMARKS  The fceSetMode function sets the FTP transfer mode. Pass
                'A' to specify ASCII mode and 'B' to specify binary mode.

                Since the FTP default is usually ASCII, it is good practice
                to always specify the transfer mode before the first call
                to fceGetFile or fcePutFile.

                If unsure of the transfer mode, choose binary.

       RETURNS  < 0 : An error has occurred. Call fceErrorText.

       EXAMPLE

                {set ASCII mode}
                Code := fceSetMode(0, 'A');

                {set binary mode}
                Code := fceSetMode(0, 'B')

      ALSO SEE fceGetFile and fcePutFile.




























     FCE4D Reference Manual                                    Page 26

      +-----------------+-------------------------------------------------+
      | fceSetServerDir | Sets the FTP directory.                         |
      +-----------------+-------------------------------------------------+


        SYNTAX  function fceSetServerDir(
                    Channel : Integer;   {channel number}
                    DirName : PChar)     {directory name}
                  : Integer;

       REMARKS  The fceSetServerDir sets the FTP directory to 'DirName'
                which is used for subsequent FCE calls.

                Note that UNIX FTP servers use forward slashes for
                directories while Windows FTP servers use backward
                slashes.


       RETURNS  < 0 : An error has occurred. Call fceErrorText.

       EXAMPLE

                var
                  Code : Integer;
                  Ptr  : PChar;

                {set server directory to 'mystuff.dir'}
                GetMem(Ptr,64); StrPCopy(Ptr,'mystuff.dir');
                Code := fceSetServerDir(0, Ptr);
                FreeMem(Ptr, 64);
                If Code < 0 then
                  begin
                    DisplayError(Memo, Code);
                    exit
                  end;
                {close connection}
                Code := fceClose(0);
                {release FCE}
                Code := fceRelease;


      ALSO SEE
















     FCE4D Reference Manual                                    Page 27

      +--------------+----------------------------------------------------+
      | fceSetString | Sets string parameter.                             |
      +--------------+----------------------------------------------------+


        SYNTAX  function fceSetString(
                    Channel   : Integer; {channel number}
                    ParamName : Integer; {parameter name}
                    ParamPtr  : PChar)   {parameter string}
                  : Integer;

       REMARKS  The fceSetString function sets the string parameter
                'ParamName' to 'ParamPtr'.

                FCE_SET_LOG_FILE is used to specify the log file name. Log
                files can be quite large, so use only when necessary.

                FCE_WRITE_TO_LOG is used to write a string (message) to
                a log file.

       RETURNS  < 0 : An error has occurred. Call fceErrorText.

       EXAMPLE

               var
                 Ptr : PChar;

               GetMem(Ptr, 50);
               {open LOG file}
               StrPCopy(Ptr, 'program.log');
               Code := fceSetString(0, FCE_SET_LOG_FILE, Ptr);

               {write 'hello' to LOG file}
               StrPCopy(Ptr, 'hello');
               Code := fceSetString(0, FCE_WRITE_TO_LOG, Ptr);

               FreeMem(Ptr, 50);

      ALSO SEE fceSetInteger



















     FCE4D Reference Manual                                    Page 28

