# Class Ftp_client.ftp_client_pi

    class ftp_client_pi : ?event_system:Unixqueue.event_system -> ?onempty:ftp_state -> unit -> ?onclose:unit -> unit -> ?onerrorstate:exn -> unit -> ?onusererror:exn -> unit -> Unix.file_descr -> object .. end

The client protocol interpreter...

has a queue of commands that are sent to the server in turn.

`onempty` is called when the last command of the queue has been processed.

`onclose` is called when the control connection is closed by the FTP server (e.g. as reaction of the QUIT command).

`onerrorstate` is called when an ``Error` state is reached (serious error condition).

`onusererror` is called when callbacks (i.e. `onreply`) raise exceptions.

    method add_cmd : ?onreply:(ftp_state -> reply -> unit) ->
           cmd -> unit

Add another command to the queue. The protocol interpreter does not check whether this command is allowed in the current ftp_state or not. For every reply of the server `onreply` is called. Due to the FTP specification there may be several replies for a command: First, zero or more replies with `cmd_state = `Preliminary`, and then exactly one reply with a final state.

    method send_abort : unit -> unit

Sends immediately an `ABOR` command, even when a data transfer is in progress.

TODO - not yet implemented

    method run : unit -> unit

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

    method ftp_state : ftp_state

Returns the current ftp_state

    method state : unit Uq_engines.engine_state

The state in the sense of `Uq_engines`. Possible values are:

- ``Working _`: The control connection is still active. The `int` argument is currently meaningless.
- ``Done()`: The control connection has been terminated.
- ``Error e`: A violation of the FTP protocol happened, or another exception `e` occurred
- ``Aborted`: The `abort` method was called

    method abort : unit -> unit

Shuts any active connection immediately down, and changes the state of the engine to ``Aborted`.

    method event_system : Unixqueue.event_system

The used event system

    method is_empty : bool

Whether the queue is empty