FTPlib is a C library providing communication facilities implementing the client side of the Internet File Transfer Protocol (FTP). Thus, it allows applications to interact with FTP servers. It is heavily based on the source code of NetKit-ftp , a popular FTP client program for Unix machines.
FTPlib is written in C, but bindings for a large subset of the API are also provided for the Objective Caml language.
Briefly, you have all classic high level FTP commands for connecting, listing, changing, creating, and deleting directories, renaming, deleting, and transfering files.
The library supports “FTP gateways”: if the environment variable FTP_GATEWAY is set, ftp_open will try to open the connection to this host, providing login@server as login.
Low level functions are also provided, that allow to:
Have a look at the ftplib.h file for details. An example toy application is provided in example.c.
All high level C functions are mapped to Caml ones, but low level functions are not available (they may be in the future, if I figure out how to copy arbitrary blocks of bytes from C to Caml).
Have a look at the ftp.ml file for details.
$ tar xvzf ftplib.tgz $ cd ftplib
If you don’t want the caml bindings, uncomment the appropriate line in the Makefile, then make libftp.a. Type make example to compile the toy example.
If you want the caml bindings, make sure the appropriate line is not uncommented in the makefile, and set the appropriate value to the Makefile CAMLH_DIR variable. Do make libftp.a ftp.cmxa ftp.cma. ftp.cmxa is a native code caml library, ftp.cma a bytecode caml library. You may want to build only one of these. make ocamlftp builds a Caml toplevel containing FTPlib. You can then use this toplevel as a primitive FTP client!
This documentation is awfully short and incomplete.
The library is usable but a bit incomplete as well. It hasn’t been tested extensively so far, but I guess NetKit-ftp base code is pretty stable. It is currently used in the wsync application (A Caml application, that uses only a small subset of the API).
Send bug reports, comments, suggestions, whatever to elviok AT free DOT fr.
The File Transfer Protocol specification, a bit confused, is described in [2, 3]. For a synthetic, commented, description of the protocol, see .
Other FTP related specifications are [5, 6, 7].