📄 net-ftpclient-features.html
字号:
<!-- Copyright (C) 2003 Red Hat, Inc. --><!-- 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 is obtained from the copyright holder. --><HTML><HEAD><TITLE>FTP Client Features</TITLE><meta name="MSSmartTagsPreventParsing" content="TRUE"><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+"><LINKREL="HOME"TITLE="eCos Reference Manual"HREF="ecos-ref.html"><LINKREL="UP"TITLE="FTP Client for eCos TCP/IP Stack"HREF="net-ftpclient.html"><LINKREL="PREVIOUS"TITLE="FTP Client for eCos TCP/IP Stack"HREF="net-ftpclient.html"><LINKREL="NEXT"TITLE="CRC Algorithms"HREF="services-crc.html"></HEAD><BODYCLASS="CHAPTER"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">eCos Reference Manual</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="net-ftpclient.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="services-crc.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="CHAPTER"><H1><ANAME="NET-FTPCLIENT-FEATURES">Chapter 49. FTP Client Features</H1><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="NET-FTPCLIENT-FEATURES-API">FTP Client API</H1><P>This package implements an FTP client. The API is in include file<TTCLASS="FILENAME">install/include/ftpclient.h</TT> and it can be used thus:<TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">#include <network.h>#include <ftpclient.h></PRE></TD></TR></TABLE>It looks like this:</P><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="NET-FTPCLIENT-FEATURES-API-GET">ftp_get</H2><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">int ftp_get(char * hostname, char * username, char * passwd, char * filename, char * buf, unsigned buf_size, ftp_printf_t ftp_printf);</PRE></TD></TR></TABLE><P>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 ‘/’ file separators,not ‘\’.The file is placed into <TTCLASS="PARAMETER"><I>buf</I></TT>.<TTCLASS="PARAMETER"><I>buf</I></TT> has maximum size <TTCLASS="PARAMETER"><I>buf_size</I></TT>.If the file is bigger than this, thetransfer fails and <SPANCLASS="ERRORCODE">FTP_TOOBIG</SPAN> 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.</P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="NET-FTPCLIENT-FEATURES-API-PUT">ftp_put</H2><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">int ftp_put(char * hostname, char * username, char * passwd, char * filename, char * buf, unsigned buf_size, ftp_printf_t ftp_printf);</PRE></TD></TR></TABLE><P>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 ‘/’ file separators,not ‘\’.The contents of <TTCLASS="PARAMETER"><I>buf</I></TT> 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.</P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="NET-FTPCLIENT-FEATURES-API-PRINTF">ftpclient_printf</H2><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">void ftpclient_printf(unsigned error, const char *fmt, ...);</PRE></TD></TR></TABLE><P><TTCLASS="FUNCTION">ftp_get()</TT> and <TTCLASS="FUNCTION">ftp_put</TT>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.<TTCLASS="PARAMETER"><I>error</I></TT> will be true when the message to print is anerror message. Otherwise the message is diagnostic, eg. the commands sentand received from the server.</P></DIV></DIV></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="net-ftpclient.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="ecos-ref.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="services-crc.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">FTP Client for eCos TCP/IP Stack</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="net-ftpclient.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">CRC Algorithms</TD></TR></TABLE></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -