diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-06-02 01:14:12 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-06-02 01:14:12 +0000 |
commit | 6f39c643ac7af0880f49f7673307053db11218e9 (patch) | |
tree | 7d6b9fe3151d71661e51125e108087d3c6f5906c /apps/netutils/ftpc/ftpc_transfer.c | |
parent | df12f072cba62c2c458a7845b4e9b30c30a4af33 (diff) | |
download | nuttx-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_transfer.c')
-rw-r--r-- | apps/netutils/ftpc/ftpc_transfer.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/apps/netutils/ftpc/ftpc_transfer.c b/apps/netutils/ftpc/ftpc_transfer.c index 640e92276..bc0ca8b03 100644 --- a/apps/netutils/ftpc/ftpc_transfer.c +++ b/apps/netutils/ftpc/ftpc_transfer.c @@ -115,7 +115,10 @@ static int ftp_pasvmode(struct ftpc_session_s *session, return ERROR; } - /* Request passive mode */ + /* Request passive mode. The server normally accepts PASV with code 227. + * Its response is a single line showing the IP address of the server and + * the TCP port number where the server is accepting connections. + */ ret = ftpc_cmd(session, "PASV"); if (ret < 0 || !ftpc_connected(session)) @@ -277,12 +280,25 @@ int ftpc_xfrmode(struct ftpc_session_s *session, uint8_t xfrmode) { int ret; + /* Check if we have already selected the requested mode */ + DEBUGASSERT(xfrmode != FTPC_XFRMODE_UNKNOWN); if (session->xfrmode != xfrmode) - { - ret = ftpc_cmd(session, "TYPE %c", xfrmode == FTPC_XFRMODE_ASCII ? 'A' : 'I'); - session->xfrmode = xfrmode; - } + { + /* Send the TYPE request to control the binary flag. Parameters for the + * TYPE request include: + * + * A: Turn the binary flag off. + * A N: Turn the binary flag off. + * I: Turn the binary flag on. + * L 8: Turn the binary flag on. + * + * The server accepts the TYPE request with code 200. + */ + + ret = ftpc_cmd(session, "TYPE %c", xfrmode == FTPC_XFRMODE_ASCII ? 'A' : 'I'); + session->xfrmode = xfrmode; + } return OK; } |