From 971830b005e76311a0950d26f6862997c892e76a Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 2 Jun 2011 15:05:48 +0000 Subject: Add support so that fdopen() may be used on socket descriptors git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3659 42af7a65-404d-4744-a932-0658087f49c3 --- apps/examples/README.txt | 4 ++++ apps/include/ftpc.h | 9 ++++++++- apps/netutils/ftpc/ftpc_connect.c | 8 ++------ 3 files changed, 14 insertions(+), 7 deletions(-) (limited to 'apps') 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; -- cgit v1.2.3