⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ftplib.html

📁 Vxworks API操作系统和驱动程序设计API。压缩的HTML文件
💻 HTML
📖 第 1 页 / 共 3 页
字号:
This routine initiates a transfer via a remote FTP serverin the following order:<table></tr><tr valign=top><td>(1)<td>Establishes a connection to the FTP server on the specified host.</tr><tr valign=top><td>(2)<td>Logs in with the specified user name, password, and account,as necessary for the particular host.</tr><tr valign=top><td>(3)<td>Sets the transfer type to image by sending the command "TYPE I".</tr><tr valign=top><td>(4)<td>Changes to the specified directory by sendingthe command "CWD <i>dirname</i>".</tr><tr valign=top><td>(5)<td>Sends the specified transfer commandwith the specified filename as an argument, and establishes a data connection.Typical transfer commands are "STOR %s", to write to a remote file,or "RETR %s", to read a remote file.</table>The resulting control and data connection file descriptors are returnedvia <i>pCtrlSock</i> and <i>pDataSock</i>, respectively.<p>After calling this routine, the data can be read or written to the remoteserver by reading or writing on the file descriptor returned in<i>pDataSock</i>.  When all incoming data has been read (as indicated by an EOF when reading the data socket) and/or all outgoing data has beenwritten, the data socket fd should be closed.  The routine <b><a href="./ftpLib.html#ftpReplyGet">ftpReplyGet</a>(&nbsp;)</b>should then be called to receive the final reply on the control socket,after which the control socket should be closed.<p>If the FTP command does not involve data transfer, <i>pDataSock</i> should be NULL, in which case no data connection will be established. The only FTP commands supported for this case are DELE, RMD, and MKD.<p></blockquote><h4>EXAMPLE</h4><blockquote><p>The following code fragment reads the file "/usr/fred/myfile" from thehost "server", logged in as user "fred", with password "magic"and no account name.<p><pre>    #include "vxWorks.h"    #include "ftpLib.h"    int       ctrlSock;    int       dataSock;    char      buf [512];    int       nBytes;    STATUS    status;    if (ftpXfer ("server", "fred", "magic", "",                 "RETR %s", "/usr/fred", "myfile",                 &amp;ctrlSock, &amp;dataSock) == ERROR)        return (ERROR);    while ((nBytes = read (dataSock, buf, sizeof (buf))) &gt; 0)        {        ...        }    close (dataSock);    if (nBytes &lt; 0)             /* read error? */        status = ERROR;    if (ftpReplyGet (ctrlSock, TRUE) != FTP_COMPLETE)        status = ERROR;    if (ftpCommand (ctrlSock, "QUIT", 0, 0, 0, 0, 0, 0) != FTP_COMPLETE)        status = ERROR;    close (ctrlSock);</pre></blockquote><h4>RETURNS</h4><blockquote><p><p>OK, or ERROR if any socket cannot be created or if a connection cannot bemade.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ftpLib.html#top">ftpLib</a></b>, <b><a href="./ftpLib.html#ftpReplyGet">ftpReplyGet</a>(&nbsp;)</b><hr><a name="ftpReplyGet"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>ftpReplyGet(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>ftpReplyGet(&nbsp;)</strong> - get an FTP command reply</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int ftpReplyGet    (    int  ctrlSock,            /* control socket fd of FTP connection */    BOOL expecteof            /* TRUE = EOF expected, FALSE = EOF is error */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine has been superceded by <b><a href="./ftpLib.html#ftpReplyGetEnhanced">ftpReplyGetEnhanced</a>(&nbsp;)</b><p>This routine gets a command reply on the specified control socket.<p>The three-digit reply code from the first line is saved and interpreted.The left-most digit of the reply code identifies the type of code(see RETURNS below).<p>The caller's error status is always set to the complete three-digit reply coderegardless of the actual reply value (see the manual entry for <b><a href="./errnoLib.html#errnoGet">errnoGet</a>(&nbsp;)</b>).If the reply code indicates an error, the entire replyis printed if the ftp error printing is enabled (see the manualentry for <b>ftpLibDebugOptionsSet(&nbsp;)</b>).<p>If an EOF is encountered on the specified control socket, but no EOF wasexpected (<i>expecteof</i> == FALSE), then ERROR is returned.<p></blockquote><h4>RETURNS</h4><blockquote><p><p>&nbsp;1&nbsp;=&nbsp;<b>FTP_PRELIM</b>&nbsp;(positive&nbsp;preliminary)<br>&nbsp;2&nbsp;=&nbsp;<b>FTP_COMPLETE</b>&nbsp;(positive&nbsp;completion)<br>&nbsp;3&nbsp;=&nbsp;<b>FTP_CONTINUE</b>&nbsp;(positive&nbsp;intermediate)<br>&nbsp;4&nbsp;=&nbsp;<b>FTP_TRANSIENT</b>&nbsp;(transient&nbsp;negative&nbsp;completion)<br>&nbsp;5&nbsp;=&nbsp;<b>FTP_ERROR</b>&nbsp;(permanent&nbsp;negative&nbsp;completion)<p>ERROR if there is a read/write error or an unexpected EOF.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ftpLib.html#top">ftpLib</a></b><hr><a name="ftpReplyGetEnhanced"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>ftpReplyGetEnhanced(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>ftpReplyGetEnhanced(&nbsp;)</strong> - get an FTP command reply</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int ftpReplyGetEnhanced    (    int    ctrlSock,          /* control socket fd of FTP connection */    BOOL   expecteof,         /* TRUE = EOF expected, FALSE = EOF is error */    char * replyString,       /* Location to store text of reply, or NULL */    int    stringLengthMax    /* Maximum length of reply (not including NULL) */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine supercedes <b><a href="./ftpLib.html#ftpReplyGet">ftpReplyGet</a>(&nbsp;)</b><p>This routine gets a command reply on the specified control socket.<p>The three-digit reply code from the first line is saved and interpreted.The left-most digit of the reply code identifies the type of code(see RETURNS below).<p>The caller's error status is always set to the complete three-digit reply code(see the manual entry for <b><a href="./errnoLib.html#errnoGet">errnoGet</a>(&nbsp;)</b>).If the reply code indicates an error, the entire replyis printed if the ftp error printing is enabled (see the manualentry for <b>ftpLibDebugOptionsSet(&nbsp;)</b>).<p>The last line of text retrieved from the servers response is stored<br>&nbsp;&nbsp;&nbsp;&nbsp;in&nbsp;the&nbsp;location&nbsp;specified&nbsp;by&nbsp;replyString.&nbsp;&nbsp;&nbsp;If&nbsp;replyString&nbsp;is&nbsp;NULL<br>&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;parameter&nbsp;is&nbsp;ignored.<p>If an EOF is encountered on the specified control socket, but no EOF wasexpected (<i>expecteof</i> == FALSE), then ERROR is returned.<p></blockquote><h4>RETURNS</h4><blockquote><p><p>&nbsp;The&nbsp;complete&nbsp;FTP&nbsp;response&nbsp;code&nbsp;(see&nbsp;RFC&nbsp;#959)<p>ERROR if there is a read/write error or an unexpected EOF.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ftpLib.html#top">ftpLib</a></b><hr><a name="ftpHookup"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>ftpHookup(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>ftpHookup(&nbsp;)</strong> - get a control connection to the FTP server on a specified host</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int ftpHookup    (    char * host               /* server host name or inet address */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine establishes a control connection to the FTP server on thespecified host.  This is the first step in interacting with a remote FTPserver at the lowest level.  (For a higher-level interaction with a remoteFTP server, see the manual entry for <b><a href="./ftpLib.html#ftpXfer">ftpXfer</a>(&nbsp;)</b>.)<p></blockquote><h4>RETURNS</h4><blockquote><p><p>The file descriptor of the control socket, or ERROR if the Internetaddress or the host name is invalid, if a socket could not be created, orif a connection could not be made.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ftpLib.html#top">ftpLib</a></b>, <b><a href="./ftpLib.html#ftpLogin">ftpLogin</a>(&nbsp;)</b>, <b><a href="./ftpLib.html#ftpXfer">ftpXfer</a>(&nbsp;)</b><hr><a name="ftpLogin"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>ftpLogin(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>ftpLogin(&nbsp;)</strong> - log in to a remote FTP server</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS ftpLogin    (    int    ctrlSock,          /* fd of login control socket */    char * user,              /* user name for host login */    char * passwd,            /* password for host login */    char * account            /* account for host login */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine logs in to a remote server with the specified user name,password, and account name, as required by the specific remote host.  Thisis typically the next step after calling <b><a href="./ftpLib.html#ftpHookup">ftpHookup</a>(&nbsp;)</b> in interacting with aremote FTP server at the lowest level.  (For a higher-level interactionwith a remote FTP server, see the manual entry for <b><a href="./ftpLib.html#ftpXfer">ftpXfer</a>(&nbsp;)</b>).<p></blockquote><h4>RETURNS</h4><blockquote><p><p>OK, or ERROR if the routine is unable to log in.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ftpLib.html#top">ftpLib</a></b>, <b><a href="./ftpLib.html#ftpHookup">ftpHookup</a>(&nbsp;)</b>, <b><a href="./ftpLib.html#ftpXfer">ftpXfer</a>(&nbsp;)</b><hr><a name="ftpDataConnInitPassiveMode"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>ftpDataConnInitPassiveMode(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>ftpDataConnInitPassiveMode(&nbsp;)</strong> - initialize an FTP data connection using PASV mode</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int ftpDataConnInitPassiveMode    (    int ctrlSock              /* fd of associated control socket */    )</pre>

⌨️ 快捷键说明

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