Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
== Outdated egg! This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for [[/eggref/5/ftp|the CHICKEN 5 version of this egg]], if it exists. If it does not exist, there may be equivalent functionality provided by another egg; have a look at the [[https://wiki.call-cc.org/chicken-projects/egg-index-5.html|egg index]]. Otherwise, please consider porting this egg to the current version of CHICKEN. [[tags: egg]] == ftp [[toc:]] === Description A simple FTP client library. === Author [[/users/felix winkelmann|felix winkelmann]] === Requirements None === Documentation Errors triggered by invalid or negative replies from the FTP server are signalled by raising a compund condition of the kinds {{exn}} and {{ftp}}. The error code of a {{ftp}} condition can be accessed with the {{code}} property. This extension provides the {{ftp}} module. ==== ftp:connect <procedure>(ftp:connect HOSTNAME USERNAME PASSWORD [VERBOSE [PORT]])</procedure> Connects to the server {{HOSTNAME}} using the FTP protocol and identifies this client with {{USERNAME}} with a given {{PASSWORD}} (all strings). If the optional argument {{VERBOSE}} is given and not {{#f}}, then a protocol of the communication with the server is written to the value of {{(current-error-port)}}. {{PORT}} specifies the port-number and defaults to {{21}}. This procedure returns an object representing the FTP session. ==== ftp:disconnect <procedure>(ftp:disconnect FTP)</procedure> Closes the connection identified by the session object {{FTP}}. ==== ftp:ftp? <procedure>(ftp:ftp? X)</procedure> Returns {{#t}} if {{X}} is an FTP session object, or {{#f}} otherwise. ==== ftp:set-type! <procedure>(ftp:set-type! FTP TYPE)</procedure> Sets the transmission to binary or character type. {{TYPE}} should one of the symbols {{binary, image}} or {{ascii}}. ==== ftp:set-mode! <procedure>(ftp:set-mode! FTP MODE)</procedure> Selects active or passive mode. {{MODE}} should one of the symbols {{active}} or {{passive}}. Passive mode is the default. ==== ftp:change-directory <procedure>(ftp:change-directory FTP DIR)</procedure> Changes the current directory of the FTP session {{FTP}} to {{DIR}}. ==== ftp:open-list <procedure>(ftp:open-list FTP [MASK [LONG]])</procedure> Returns an input-port from which a directory list can be retrieved. The optional string {{MASK}} selects files to be listed (like {{*.scm}}). If the optional flag {{LONG}} is given and not {{#f}}, then the directory is requested in "long" format (if the server differentiates between short and long directory format). After the directory has been read, the port must be closed to allow further read/write operations in this FTP session. ==== ftp:open-input-file <procedure>(ftp:open-input-file FTP FILENAME)</procedure> Opens the file {{FILENAME}} for retrieval from the FTP server and returns an input-port from which the file can be read. After the file has been read, the port must be closed to allow further read/write operations in this FTP session. ==== ftp:open-output-file <procedure>(ftp:open-output-file FTP FILENAME)</procedure> Opens the file {{FILENAME}} the FTP server and returns an output-port to which the data to be stored should be written. After the file has been written, the port must be closed to allow further read/write operations in this FTP session. ==== ftp:abort <procedure>(ftp:abort FTP)</procedure> Aborts any transmission currently in progress for the given FTP session. ==== ftp:delete-file <procedure>(ftp:delete-file FTP FILENAME)</procedure> Deletes the file {{FILENAME}} on the FTP server. ==== ftp:rename-file <procedure>(ftp:rename-file FTP OLD NEW)</procedure> Renames the file {{OLD}} on the FTP server to {{NEW}}. ==== ftp:delete-directory <procedure>(ftp:delete-directory FTP DIRNAME)</procedure> Deletes the directory {{DIRNAME}} on the FTP server. ==== ftp:create-directory <procedure>(ftp:create-directory FTP DIRNAME)</procedure> Creates the directory {{DIRNAME}} on the FTP server. === Example <enscript highlight="scheme"> ; Connect to FTP server: (define f (ftp:connect "ftp.foo.com" "joe" "secret")) ; Retrieve directory listing: (let ([p (ftp:open-list f)]) (display (read-string #f p)) (close-input-port p) ) ; Download a file: (with-output-to-file "foo.txt" (lambda () (let ([p (ftp:open-input-file f "foo.txt")]) (display (read-string #f p)) (close-input-port p) ) ) ) ; Terminate connection: (ftp:disconnect f) </enscript> === Changelog * 1.4 added regex dependency * 1.3 Added matchable to list of dependencies in meta file * 1.2 Ported to Chicken 4 * 1.1 Added support for passive mode. * 1.0 Initial release === License Copyright (c) 2003, Felix L. Winkelmann All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you multiply 2 by 4?