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

📄 ftplib.html

📁 Vxworks API操作系统和驱动程序设计API。压缩的HTML文件
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/ftpLib.html - generated by refgen from ftpLib.c --> <title> ftpLib </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.htm"><i>VxWorks API Reference :  OS Libraries</i></a></p></blockquote><h1>ftpLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>ftpLib</strong> - File Transfer Protocol (FTP) library </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><a href="./ftpLib.html#ftpCommand">ftpCommand</a>(&nbsp;)</b>  -  send an FTP command and get the reply <br><b><a href="./ftpLib.html#ftpCommandEnhanced">ftpCommandEnhanced</a>(&nbsp;)</b>  -  send an FTP command and get the complete RFC reply code<br><b><a href="./ftpLib.html#ftpXfer">ftpXfer</a>(&nbsp;)</b>  -  initiate a transfer via FTP<br><b><a href="./ftpLib.html#ftpReplyGet">ftpReplyGet</a>(&nbsp;)</b>  -  get an FTP command reply<br><b><a href="./ftpLib.html#ftpReplyGetEnhanced">ftpReplyGetEnhanced</a>(&nbsp;)</b>  -  get an FTP command reply<br><b><a href="./ftpLib.html#ftpHookup">ftpHookup</a>(&nbsp;)</b>  -  get a control connection to the FTP server on a specified host<br><b><a href="./ftpLib.html#ftpLogin">ftpLogin</a>(&nbsp;)</b>  -  log in to a remote FTP server<br><b><a href="./ftpLib.html#ftpDataConnInitPassiveMode">ftpDataConnInitPassiveMode</a>(&nbsp;)</b>  -  initialize an FTP data connection using PASV mode<br><b><a href="./ftpLib.html#ftpDataConnInit">ftpDataConnInit</a>(&nbsp;)</b>  -  initialize an FTP data connection using PORT mode<br><b><a href="./ftpLib.html#ftpDataConnGet">ftpDataConnGet</a>(&nbsp;)</b>  -  get a completed FTP data connection<br><b><a href="./ftpLib.html#ftpLs">ftpLs</a>(&nbsp;)</b>  -  list directory contents via FTP<br><b><a href="./ftpLib.html#ftpLibDebugOptionSet">ftpLibDebugOptionSet</a>(&nbsp;)</b>  -  set the debug level of the ftp library routines<br><b><a href="./ftpLib.html#ftpTransientConfigSet">ftpTransientConfigSet</a>(&nbsp;)</b>  -  set parameters for host <b>FTP_TRANSIENT</b> responses <br><b><a href="./ftpLib.html#ftpTransientConfigGet">ftpTransientConfigGet</a>(&nbsp;)</b>  -  get parameters for host <b>FTP_TRANSIENT</b> responses <br><b><a href="./ftpLib.html#ftpTransientFatalInstall">ftpTransientFatalInstall</a>(&nbsp;)</b>  -  set applette to stop FTP transient host responses<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library provides facilities for transferring files to and from a hostvia File Transfer Protocol (FTP).  This library implements only the"client" side of the FTP facilities.<p></blockquote><h4>FTP IN VXWORKS</h4><blockquote><p>For most purposes, you should access the services of <b><a href="./ftpLib.html#top">ftpLib</a></b> by means of <b><a href="./netDrv.html#top">netDrv</a></b>, a VxWorks I/O driver that supports transparent access to remote files by means of standard I/O system calls.  Before attempting to access <b><a href="./ftpLib.html#top">ftpLib</a></b> services directly, you should check whether <b><a href="./netDrv.html#top">netDrv</a></b> already provides the same access for less trouble.<p></blockquote><h4>HIGH-LEVEL INTERFACE</h4><blockquote><p>The routines <b><a href="./ftpLib.html#ftpXfer">ftpXfer</a>(&nbsp;)</b> and <b><a href="./ftpLib.html#ftpReplyGet">ftpReplyGet</a>(&nbsp;)</b> provide the highest level ofdirect interface to FTP.  The routine <b><a href="./ftpLib.html#ftpXfer">ftpXfer</a>(&nbsp;)</b> connects to a specifiedremote FTP server, logs in under a specified user name, and initiates aspecified data transfer command.  The routine <b><a href="./ftpLib.html#ftpReplyGet">ftpReplyGet</a>(&nbsp;)</b> receivescontrol reply messages sent by the remote FTP server in response to thecommands sent.<p></blockquote><h4>LOW-LEVEL INTERFACE</h4><blockquote><p>The routines <b><a href="./ftpLib.html#ftpHookup">ftpHookup</a>(&nbsp;)</b>, <b><a href="./ftpLib.html#ftpLogin">ftpLogin</a>(&nbsp;)</b>, <b><a href="./ftpLib.html#ftpDataConnInit">ftpDataConnInit</a>(&nbsp;)</b>, <b><a href="./ftpLib.html#ftpDataConnGet">ftpDataConnGet</a>(&nbsp;)</b>,<b><a href="./ftpLib.html#ftpCommand">ftpCommand</a>(&nbsp;)</b>, <b><a href="./ftpLib.html#ftpCommandEnhanced">ftpCommandEnhanced</a>(&nbsp;)</b>  provide the primitives necessary to create and use control and data connections to remote FTP servers.  The following example shows how to use these low-level routines.  It implements roughly the same function as <b><a href="./ftpLib.html#ftpXfer">ftpXfer</a>(&nbsp;)</b>.<p><pre>char *host, *user, *passwd, *acct, *dirname, *filename;int ctrlSock = ERROR; /* This is the control socket file descriptor */int dataSock = ERROR; /* This is the data path socket file descriptor */if (((ctrlSock = ftpHookup (host)) == ERROR)                                  ||    (ftpLogin (ctrlSock, user, passwd, acct) == ERROR)                        ||    (ftpCommand (ctrlSock, "TYPE I", 0, 0, 0, 0, 0, 0) != FTP_COMPLETE)       ||    (ftpCommand (ctrlSock, "CWD %s", dirname, 0, 0, 0, 0, 0) != FTP_COMPLETE) ||    ((dataSock = ftpDataConnInit (ctrlSock)) == ERROR)                        ||    (ftpCommand (ctrlSock, "RETR %s", filename, 0, 0, 0, 0, 0) != FTP_PRELIM) ||    ((dataSock = ftpDataConnGet (dataSock)) == ERROR))    {    /* an error occurred; close any open sockets and return */    if (ctrlSock != ERROR)        close (ctrlSock);    if (dataSock != ERROR)        close (dataSock);    return (ERROR);    }</pre>For even lower-level access,  please note that the sockets provided by <b><a href="./ftpLib.html#ftpHookup">ftpHookup</a>(&nbsp;)</b> and <b><a href="./ftpLib.html#ftpDataConnInit">ftpDataConnInit</a>(&nbsp;)</b> are standard TCP/IP sockets.  Developers may implement <b><a href="./ioLib.html#read">read</a>(&nbsp;)</b>, <b><a href="./ioLib.html#write">write</a>(&nbsp;)</b> and <b><a href="./selectLib.html#select">select</a>(&nbsp;)</b> calls using these sockets for maximum flexibility.<p>To use this feature, include the following component:<b>INCLUDE_FTP</b><p></blockquote><h4>TUNING FOR MULTIPLE FILE ACCESS</h4><blockquote><p><p>Please note that accessing multiple files simultaneously may require increasing the memory available to the network stack.  You can examine memory requirements by using <b><a href="./netShow.html#netStackSysPoolShow">netStackSysPoolShow</a>(&nbsp;)</b> and <b><a href="./netShow.html#netStackDataPoolShow">netStackDataPoolShow</a>(&nbsp;)</b>before opening and after closing files.<p>You may need to modify the following macro definitions according to your specific memory requirements:<p>&nbsp;<b>NUM_64</b><br>&nbsp;<b>NUM_128</b><br>&nbsp;<b>NUM_256</b><br>&nbsp;<b>NUM_512</b><br>&nbsp;<b>NUM_1024</b><br>&nbsp;<b>NUM_2048</b><br>&nbsp;<b>NUM_SYS_64</b><br>&nbsp;<b>NUM_SYS_128</b><br>&nbsp;<b>NUM_SYS_256</b><br>&nbsp;<b>NUM_SYS_512</b><br>&nbsp;<b>NUM_SYS_1024</b><br>&nbsp;<b>NUM_SYS_2048</b><p>Please also note that each concurrent file access requires three file descriptors (File, Control and Socket).  The following macro definition may need modification per your application:<b>NUM_FILES</b><p>Developers are encouraged to enable the error reporting facility during debugging using the function <b>ftpLibDebugOptionsSet(&nbsp;)</b>.  The output is displayed via the logging facility.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>ftpLib.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./netDrv.html#top">netDrv</a></b>, <b><a href="./logLib.html#top">logLib</a></b><hr><a name="ftpCommand"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>ftpCommand(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>ftpCommand(&nbsp;)</strong> - send an FTP command and get the reply </p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int ftpCommand    (    int    ctrlSock,          /* fd of control connection socket */    char * fmt,               /* format string of command to send */    int    arg1,              /* first of six args to format string */    int    arg2,    int    arg3,    int    arg4,    int    arg5,    int    arg6    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This command has been superceded by <b><a href="./ftpLib.html#ftpCommandEnhanced">ftpCommandEnhanced</a>(&nbsp;)</b> <p>This routine sends the specified command on the specified socket, whichshould be a control connection to a remote FTP server.The command is specified as a string in <b><a href="./fioLib.html#printf">printf</a>(&nbsp;)</b> format with upto six arguments.<p>After the command is sent, <b><a href="./ftpLib.html#ftpCommand">ftpCommand</a>(&nbsp;)</b> waits for the reply from theremote server.  The FTP reply code is returned in the same way as in<b><a href="./ftpLib.html#ftpReplyGet">ftpReplyGet</a>(&nbsp;)</b>.<p></blockquote><h4>EXAMPLE</h4><blockquote><p><pre>ftpCommand (ctrlSock, "TYPE I", 0, 0, 0, 0, 0, 0);     /* image-type xfer */ftpCommand (ctrlSock, "STOR %s", file, 0, 0, 0, 0, 0); /* init file write */</pre></blockquote><h4>RETURNS</h4><blockquote><p><p><br>&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.<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><p>VARARGS2<hr><a name="ftpCommandEnhanced"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>ftpCommandEnhanced(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>ftpCommandEnhanced(&nbsp;)</strong> - send an FTP command and get the complete RFC reply code</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int ftpCommandEnhanced    (    int    ctrlSock,          /* fd of control connection socket */    char * fmt,               /* format string of command to send */    int    arg1,              /* first of six args to format string */    int    arg2,    int    arg3,    int    arg4,    int    arg5,    int    arg6,    char * replyString,       /* storage for the last line of the server */                              /* response or NULL */     int    replyStringLength  /* Maximum character length of the replyString */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This command supercedes <b><a href="./ftpLib.html#ftpCommand">ftpCommand</a>(&nbsp;)</b> <p>This routine sends the specified command on the specified socket, whichshould be a control connection to a remote FTP server.The command is specified as a string in <b><a href="./fioLib.html#printf">printf</a>(&nbsp;)</b> format with upto six arguments.<p>After the command is sent, <b><a href="./ftpLib.html#ftpCommand">ftpCommand</a>(&nbsp;)</b> waits for the reply from theremote server.  The FTP reply code is returned in the same way as in<b><a href="./ftpLib.html#ftpReplyGetEnhanced">ftpReplyGetEnhanced</a>(&nbsp;)</b>.<p></blockquote><h4>EXAMPLE</h4><blockquote><p><pre>ftpCommandEnhanced (ctrlSock, "TYPE I", 0, 0, 0, 0, 0, 0, 0, 0);     /* image-type xfer */ftpCommandEnhanced (ctrlSock, "STOR %s", file, 0, 0, 0, 0, 0, 0, 0); /* init file write */ftpCommandEnhanced (ctrlSock, "PASV", file, 0, 0, 0, 0, 0, reply, rplyLen); /* Get port */</pre></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.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ftpLib.html#top">ftpLib</a></b>, <b><a href="./ftpLib.html#ftpReplyGetEnhanced">ftpReplyGetEnhanced</a>(&nbsp;)</b>, <b><a href="./ftpLib.html#ftpReplyGet">ftpReplyGet</a>(&nbsp;)</b><p>VARARGS2<hr><a name="ftpXfer"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>ftpXfer(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>ftpXfer(&nbsp;)</strong> - initiate a transfer via FTP</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS ftpXfer    (    char * host,              /* name of server host */    char * user,              /* user name for host login */    char * passwd,            /* password for host login */    char * acct,              /* account for host login */    char * cmd,               /* command to send to host */    char * dirname,           /* directory to <b>cd</b> to before sending command */    char * filename,          /* filename to send with command */    int *  pCtrlSock,         /* where to return control socket fd */    int *  pDataSock          /* where to return data socket fd, (NULL == */                              /* don't open data connection) */     )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>

⌨️ 快捷键说明

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