# Class Ftp_client.ftp_client

    class ftp_client : ?event_system:Unixqueue.event_system -> ?onempty:unit -> unit -> unit -> object .. end

The ftp client is a user session that may even span several connections. However, only one server is connected at once.
Inherits

- `Uq_engines.engine` The FTP client is also an engine. The engine can be in one of four states:
  - ``Working _`: The client is still active. The `int` argument is currently meaningless.
  - ``Done()`: The client has been terminated.
  - ``Error e`: A violation of the FTP protocol happened, or another exception `e` occurred
  - ``Aborted`: The `abort` method was called

    method add : ?onsuccess:(unit -> unit) ->
           ?onerror:(exn -> unit) -> ftp_method -> unit

Adds an FTP method to the queue of methods to execute. It is no problem to add the same method twice.

When the method could be executed successfully, the function `onsuccess` is called. (By default, this function does nothing.)

If the FTP server indicates an error, the function `onerror` is called instead. The exception is either `FTP_method_temp_failure` or `FTP_method_perm_failure`. The default for `onerror` is to raise the exception again, which has the effect of setting the engine state to ``Error`. This effectively stops the FTP client. (Hard errors like socket problems or protocol violations are not reported this way, but by directly setting the engine state to ``Error`.)

    method run : unit -> unit

Starts the event system; same as `Unixqueue.run`