[En-Nut-Discussion] timeout in FTPd

Krzysztof Sawicki krzysztof.sawicki at mobile.put.edu.pl
Fri Mar 14 14:57:08 CET 2014


Hi!

I discovered that FTP data connection socket implements no timeout at 
all and there is no way to modify this by user.
What about such modification in FTPd (copy timeout from command socket, 
which is passed to NutFtpServerSession() by user, thus can be 
set/modified by user application)?:

Index: nut/pro/ftpd.c
===================================================================
--- nut/pro/ftpd.c      (revision 5582)
+++ nut/pro/ftpd.c      (working copy)
@@ -476,6 +476,11 @@
          if (session->ftp_maxseg) {
              NutTcpSetSockOpt(sock, TCP_MAXSEG, &session->ftp_maxseg, 
sizeof(session->ftp_maxseg));
          }
+
+               uint32_t tmo;aaa
+               NutTcpGetSockOpt(session->ftp_sock, SO_RCVTIMEO, &tmo, 
sizeof(tmo));
+               NutTcpSetSockOpt(sock, SO_RCVTIMEO, &tmo, sizeof(tmo));
+
          if (session->ftp_passive) {
              rc = NutTcpAccept(sock, session->ftp_data_port);
          } else {



-- 
Krzysztof Sawicki
Mobile Systems Research Labs, Poznan University of Technology


More information about the En-Nut-Discussion mailing list