summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/examples/README.txt4
-rw-r--r--apps/include/ftpc.h9
-rw-r--r--apps/netutils/ftpc/ftpc_connect.c8
3 files changed, 14 insertions, 7 deletions
diff --git a/apps/examples/README.txt b/apps/examples/README.txt
index f14037e72..2a15dac5d 100644
--- a/apps/examples/README.txt
+++ b/apps/examples/README.txt
@@ -63,6 +63,10 @@ examples/ftpc
where xx.xx.xx.xx is the IP address of the FTP server and pp is an
optional port number.
+ NOTE: The ftpc task uses the system console for input/output. It will
+ not work from NSH over a telnet NSH connection (Well, it will work you
+ just won't be able to access the command line).
+
examples/hello
^^^^^^^^^^^^^^
diff --git a/apps/include/ftpc.h b/apps/include/ftpc.h
index 211edbad4..0676a7040 100644
--- a/apps/include/ftpc.h
+++ b/apps/include/ftpc.h
@@ -112,7 +112,14 @@
typedef FAR void *SESSION;
-/* This structure provides information to connect to a host FTP server */
+/* This structure provides information to connect to a host FTP server.
+ *
+ * addr - The IPv4 address of the FTP server (or the proxy) for the FTP
+ * server.
+ * port - The port number on the FTP server to connect to. This is usually
+ * port 21 for FTP. You may set this value to zero to let FTPC
+ * select the default port number for you (CONFIG_FTP_DEFPORT).
+ */
struct ftpc_connect_s
{
diff --git a/apps/netutils/ftpc/ftpc_connect.c b/apps/netutils/ftpc/ftpc_connect.c
index a61ca2d02..ff19af324 100644
--- a/apps/netutils/ftpc/ftpc_connect.c
+++ b/apps/netutils/ftpc/ftpc_connect.c
@@ -98,7 +98,7 @@ SESSION ftpc_connect(FAR struct ftpc_connect_s *server)
/* Initialize the session structure */
session->addr.s_addr = server->addr.s_addr;
- session->port = server->port;
+ session->port = server->port ? server->port : CONFIG_FTP_DEFPORT;
session->pid = getpid();
/* Create up a timer to prevent hangs */
@@ -165,9 +165,7 @@ int ftpc_reconnect(FAR struct ftpc_session_s *session)
#ifdef CONFIG_DEBUG
tmp = inet_ntoa(session->addr);
- ndbg("Connecting to server address %s:%d\n",
- tmp, ntohl(session->port));
- free(tmp);
+ ndbg("Connecting to server address %s:%d\n", tmp, ntohl(session->port));
#endif
addr.sin_family = AF_INET;
@@ -214,10 +212,8 @@ int ftpc_reconnect(FAR struct ftpc_session_s *session)
ndbg("Connected\n");
tmp = inet_ntoa(session->cmd.raddr.sin_addr);
ndbg(" Remote address: %s:%d\n", tmp, ntohl(session->cmd.raddr.sin_port));
- free(tmp);
tmp = inet_ntoa(session->cmd.laddr.sin_addr);
ndbg(" Local address: %s:d\n", tmp, ntohl(session->cmd.laddr.sin_port));
- free(tmp);
#endif
return OK;