diff --git a/source/shared_lib/include/feathery_ftp/ftp.h b/source/shared_lib/include/feathery_ftp/ftp.h index 7e35b983..e9939570 100755 --- a/source/shared_lib/include/feathery_ftp/ftp.h +++ b/source/shared_lib/include/feathery_ftp/ftp.h @@ -189,4 +189,7 @@ extern int ftpSelect(int poll); extern int ftpGetPassivePort(); extern int ftpGetListenPort(); +extern int getLastSocketError(); +extern const char * getLastSocketErrorText(int *errNumber); + #endif /* FTP_H_ */ diff --git a/source/shared_lib/sources/feathery_ftp/ftpRuntime.c b/source/shared_lib/sources/feathery_ftp/ftpRuntime.c index 4fa06d4c..433ddee0 100644 --- a/source/shared_lib/sources/feathery_ftp/ftpRuntime.c +++ b/source/shared_lib/sources/feathery_ftp/ftpRuntime.c @@ -205,7 +205,9 @@ if(VERBOSE_MODE_ENABLED) printf("ERROR: Connection refused; Session limit reache LEN_RXBUF - pSession->rxBufWriteIdx); if(len <= 0) // has client shutdown the connection? { - if(VERBOSE_MODE_ENABLED) printf("ftpExecute ERROR ON RECEIVE for socket = %d\n",ctrlSocket); + int errorNumber = len; //getLastSocketError(); + const char *errText = getLastSocketErrorText(&errorNumber); + if(VERBOSE_MODE_ENABLED) printf("ftpExecute ERROR ON RECEIVE for socket = %d, data len = %d, error = %d [%s]\n",ctrlSocket,(LEN_RXBUF - pSession->rxBufWriteIdx),errorNumber,errText); ftpUntrackSocket(ctrlSocket); ftpCloseSession(n); diff --git a/source/shared_lib/sources/feathery_ftp/ftpTargetPosix.c b/source/shared_lib/sources/feathery_ftp/ftpTargetPosix.c index 84545910..29f1a689 100644 --- a/source/shared_lib/sources/feathery_ftp/ftpTargetPosix.c +++ b/source/shared_lib/sources/feathery_ftp/ftpTargetPosix.c @@ -36,6 +36,7 @@ #include "ftpTypes.h" #include "ftpConfig.h" #include "ftp.h" +#include "errno.h" ip_t ownIp; @@ -446,4 +447,14 @@ int ftpSelect(int poll) } } +int getLastSocketError() { + return errno; +} + +const char * getLastSocketErrorText(int *errNumber) { + int errId = (errNumber != NULL ? *errNumber : getLastSocketError()); + return strerror(errId); +} + + #endif diff --git a/source/shared_lib/sources/feathery_ftp/ftpTargetWin32.c b/source/shared_lib/sources/feathery_ftp/ftpTargetWin32.c index 93494428..b21453e7 100644 --- a/source/shared_lib/sources/feathery_ftp/ftpTargetWin32.c +++ b/source/shared_lib/sources/feathery_ftp/ftpTargetWin32.c @@ -480,4 +480,13 @@ int ftpSelect(int poll) } } +int getLastSocketError() { + return WSAGetLastError(); +} + +const char * getLastSocketErrorText(int *errNumber) { + int errId = (errNumber != NULL ? *errNumber : getLastSocketError()); + return WSAGetLastErrorMessage("",errId); +} + #endif diff --git a/source/shared_lib/sources/platform/posix/miniftpclient.cpp b/source/shared_lib/sources/platform/posix/miniftpclient.cpp index 233f5628..d7b8e6d8 100644 --- a/source/shared_lib/sources/platform/posix/miniftpclient.cpp +++ b/source/shared_lib/sources/platform/posix/miniftpclient.cpp @@ -162,7 +162,7 @@ static long file_is_downloaded(void *data) { } int file_progress(struct FtpFile *out,double download_total, double download_now, double upload_total,double upload_now) { - if(SystemFlags::VERBOSE_MODE_ENABLED) printf(" download progress [%f][%f][%f][%f] ",download_total,download_now,upload_total,upload_now); + //if(SystemFlags::VERBOSE_MODE_ENABLED) printf(" download progress [%f][%f][%f][%f] ",download_total,download_now,upload_total,upload_now); SystemFlags::OutputDebug(SystemFlags::debugNetwork," download progress [%f][%f][%f][%f] ",download_total,download_now,upload_total,upload_now); if(out != NULL &&