summaryrefslogtreecommitdiff
path: root/apps/netutils/ftpc/ftpc_listdir.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-06-02 01:14:12 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-06-02 01:14:12 +0000
commit6f39c643ac7af0880f49f7673307053db11218e9 (patch)
tree7d6b9fe3151d71661e51125e108087d3c6f5906c /apps/netutils/ftpc/ftpc_listdir.c
parentdf12f072cba62c2c458a7845b4e9b30c30a4af33 (diff)
downloadnuttx-6f39c643ac7af0880f49f7673307053db11218e9.tar.gz
nuttx-6f39c643ac7af0880f49f7673307053db11218e9.tar.bz2
nuttx-6f39c643ac7af0880f49f7673307053db11218e9.zip
Improved comments
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3658 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/netutils/ftpc/ftpc_listdir.c')
-rw-r--r--apps/netutils/ftpc/ftpc_listdir.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/apps/netutils/ftpc/ftpc_listdir.c b/apps/netutils/ftpc/ftpc_listdir.c
index e58b874e7..20653799c 100644
--- a/apps/netutils/ftpc/ftpc_listdir.c
+++ b/apps/netutils/ftpc/ftpc_listdir.c
@@ -256,7 +256,15 @@ static int ftpc_recvdir(FAR struct ftpc_session_s *session,
return ERROR;
}
- /* Send the "NLST" command */
+ /* Send the "NLST" command. Normally the server responds with a mark
+ * using code 150:
+ *
+ * - "150 File status okay; about to open data connection"
+ *
+ * It then stops accepting new connections, attempts to
+ * send the contents of the directory over the data connection, and
+ * closes the data connection.
+ */
ret = ftpc_cmd(session, "NLST");
if (ret != OK)
@@ -273,7 +281,7 @@ static int ftpc_recvdir(FAR struct ftpc_session_s *session,
return ERROR;
}
- /* Receive the NLST response */
+ /* Receive the NLST directory list */
ret = ftpc_recvtext(session, session->data.instream, outstream);
ftpc_sockclose(&session->data);
@@ -282,7 +290,24 @@ static int ftpc_recvdir(FAR struct ftpc_session_s *session,
return ERROR;
}
- /* Get the server reply */
+ /* Get the server reply. After closing the data connection, the should
+ * accept the request with:
+ *
+ * - "226 Closing data connection" if the entire directory was
+ * successfully transmitted;
+ *
+ * Or reject it with:
+ *
+ * - "425 Can't open data connection" if no TCP connection was established
+ * - "426 - Connection closed; transfer aborted" if the TCP connection was
+ * established but then broken by the client or by network failure
+ * - "451 - Requested action aborted: local error in processing" if the
+ * server had trouble reading the directory from disk.
+ *
+ * The server may reject the LIST or NLST request (with code 450 or 550)
+ * without first responding with a mark. In this case the server does not
+ * touch the data connection.
+ */
fptc_getreply(session);
return OK;