ftpclient.sgml

来自「eCos操作系统源码」· SGML 代码 · 共 120 行

SGML
120
字号
<!-- {{{ Banner                         --><!-- =============================================================== --><!--                                                                 --><!--     ftpclient.sgml                                              --><!--                                                                 --><!--     eCos TCP/IP Stacks                                          --><!--                                                                 --><!-- =============================================================== --><!-- ####COPYRIGHTBEGIN####                                          --><!--                                                                 --><!-- =============================================================== --><!-- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.  --><!-- Copyright (C) 2003 Andrew Lunn.                                 --><!-- This material may be distributed only subject to the terms      --><!-- and conditions set forth in the Open Publication License, v1.0  --><!-- or later (the latest version is presently available at          --><!-- http://www.opencontent.org/openpub/)                            --><!-- Distribution of the work or derivative of the work in any       --><!-- standard (paper) book form is prohibited unless prior           --><!-- permission obtained from the copyright holder                   --><!-- =============================================================== --><!--                                                                 -->      <!-- ####COPYRIGHTEND####                                            --><!-- =============================================================== --><!-- #####DESCRIPTIONBEGIN####                                       --><!--                                                                 --><!-- ####DESCRIPTIONEND####                                          --><!-- =============================================================== --><!-- }}} --><PART ID="net-ftpclient"><TITLE>FTP Client for eCos TCP/IP Stack</TITLE><PARTINTRO><PARA>The ftpclient package provides an FTP (File Transfer Protocol) clientfor use with the TCP/IP stack in eCos. It supports both IPv4 and IPv6and will use the DNS client, when its is part of the eCos configuration.</PARA></PARTINTRO><CHAPTER id="net-ftpclient-features"><TITLE>FTP Client Features</TITLE><SECT1 id="net-ftpclient-features-api"><TITLE>FTP Client API</TITLE><para>This package implements an FTP client.  The API is in include file<filename>install/include/ftpclient.h</filename> and it can be used thus:<programlisting>#include &lt;network.h&gt;#include &lt;ftpclient.h&gt;</programlisting>It looks like this:</para><sect2 id="net-ftpclient-features-api-get"><title>ftp_get</title><programlisting>int ftp_get(char &ast; hostname,             char &ast; username,             char &ast; passwd,             char &ast; filename,             char &ast; buf,             unsigned buf_size,            ftp_printf_t ftp_printf);</programlisting><para>Use the FTP protocol to retrieve a file from a server. Only binarymode is supported. The filename can include a directory name. Onlyuse unix style &lsquo;/&rsquo; file separators,not &lsquo;\&rsquo;.The file is placed into <parameter>buf</parameter>.<parameter>buf</parameter> has maximum size <parameter>buf_size</parameter>.If the file is bigger than this, thetransfer fails and <errorcode>FTP_TOOBIG</errorcode> is returned.Other error codes listed in the header can also be returned.If the transfer is successful the number of bytes received is returned.</para></sect2><sect2 id="net-ftpclient-features-api-put"><title>ftp_put</title><programlisting>int ftp_put(char &ast; hostname,             char &ast; username,             char &ast; passwd,             char &ast; filename,             char &ast; buf,             unsigned buf_size,            ftp_printf_t ftp_printf);</programlisting><para>Use the FTP protocol to send a file to a server.Only binarymode is supported. The filename can include a directory name. Onlyuse unix style &lsquo;/&rsquo; file separators,not &lsquo;\&rsquo;.The contents of <parameter>buf</parameter> are placed into the file on theserver. If an error occurs one of the codes listed will be returned. If thetransfer is successful zero is returned.</para></sect2><sect2 id="net-ftpclient-features-api-printf"><title>ftpclient_printf</title><programlisting>void ftpclient_printf(unsigned error, const char *fmt, ...);</programlisting><para><function>ftp_get()</function> and <function>ftp_put</function>take a pointer to a function to use for printingout diagnostic and error messages. This is a sample implementationwhich can be used if you don't want to implement the functionyourself.<parameter>error</parameter> will be true when the message to print is anerror message. Otherwise the message is diagnostic, eg. the commands sentand received from the server.</para></sect2></SECT1></CHAPTER></PART>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?