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
This commit is contained in:
parent
30bf105d10
commit
d02a36dfd9
@ -63,6 +63,10 @@ examples/ftpc
|
|||||||
where xx.xx.xx.xx is the IP address of the FTP server and pp is an
|
where xx.xx.xx.xx is the IP address of the FTP server and pp is an
|
||||||
optional port number.
|
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
|
examples/hello
|
||||||
^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
@ -112,7 +112,14 @@
|
|||||||
|
|
||||||
typedef FAR void *SESSION;
|
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
|
struct ftpc_connect_s
|
||||||
{
|
{
|
||||||
|
@ -98,7 +98,7 @@ SESSION ftpc_connect(FAR struct ftpc_connect_s *server)
|
|||||||
/* Initialize the session structure */
|
/* Initialize the session structure */
|
||||||
|
|
||||||
session->addr.s_addr = server->addr.s_addr;
|
session->addr.s_addr = server->addr.s_addr;
|
||||||
session->port = server->port;
|
session->port = server->port ? server->port : CONFIG_FTP_DEFPORT;
|
||||||
session->pid = getpid();
|
session->pid = getpid();
|
||||||
|
|
||||||
/* Create up a timer to prevent hangs */
|
/* Create up a timer to prevent hangs */
|
||||||
@ -165,9 +165,7 @@ int ftpc_reconnect(FAR struct ftpc_session_s *session)
|
|||||||
|
|
||||||
#ifdef CONFIG_DEBUG
|
#ifdef CONFIG_DEBUG
|
||||||
tmp = inet_ntoa(session->addr);
|
tmp = inet_ntoa(session->addr);
|
||||||
ndbg("Connecting to server address %s:%d\n",
|
ndbg("Connecting to server address %s:%d\n", tmp, ntohl(session->port));
|
||||||
tmp, ntohl(session->port));
|
|
||||||
free(tmp);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
addr.sin_family = AF_INET;
|
addr.sin_family = AF_INET;
|
||||||
@ -214,10 +212,8 @@ int ftpc_reconnect(FAR struct ftpc_session_s *session)
|
|||||||
ndbg("Connected\n");
|
ndbg("Connected\n");
|
||||||
tmp = inet_ntoa(session->cmd.raddr.sin_addr);
|
tmp = inet_ntoa(session->cmd.raddr.sin_addr);
|
||||||
ndbg(" Remote address: %s:%d\n", tmp, ntohl(session->cmd.raddr.sin_port));
|
ndbg(" Remote address: %s:%d\n", tmp, ntohl(session->cmd.raddr.sin_port));
|
||||||
free(tmp);
|
|
||||||
tmp = inet_ntoa(session->cmd.laddr.sin_addr);
|
tmp = inet_ntoa(session->cmd.laddr.sin_addr);
|
||||||
ndbg(" Local address: %s:d\n", tmp, ntohl(session->cmd.laddr.sin_port));
|
ndbg(" Local address: %s:d\n", tmp, ntohl(session->cmd.laddr.sin_port));
|
||||||
free(tmp);
|
|
||||||
#endif
|
#endif
|
||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user