Discuss (FTP), (FTP on .NET CF) and (FTPS, SFTP and SCP).

Timeout in edtFTPnet/Compact

no avatar
User

rafael.lasertech

Posts

3

Joined

Thu Jun 25, 2015 10:36 pm

Timeout in edtFTPnet/Compact

by rafael.lasertech » Thu Jun 25, 2015 11:02 pm

Hi,

I have a licensed edtFTPnet/Compact but I am having issues when transferring files in a very slow connection (UploadFile method) because it got stuck forever. I have enabled Log in ExFTPConnection class hoping to find the problem:

INFO [LicenseProperties] 25 Jun 2015 09:31:41.000 : Licence expiry date: 12/31/9999
INFO [LicenseProperties] 25 Jun 2015 09:31:41.000 : Production license
INFO [LicenseProperties] 25 Jun 2015 09:31:41.000 : Licence expiry date: 12/31/9999
INFO [LicenseProperties] 25 Jun 2015 09:31:41.000 : Production license
DEBUG [ExFTPClient] 25 Jun 2015 09:31:41.000 : Connecting to ***
DEBUG [HostNameResolver] 25 Jun 2015 09:31:41.000 : Resolving ***
DEBUG [HostNameResolver] 25 Jun 2015 09:31:41.000 : *** resolved to ***
DEBUG [ExFTPControlSocket] 25 Jun 2015 09:31:41.000 : Connecting directly to ftp-server ***:21
INFO [BaseSocket] 25 Jun 2015 09:31:41.000 : Connecting to ***:21
DEBUG [FTPControlSocket] 25 Jun 2015 09:31:43.000 : Setting socket timeout=120000
WARN [FTPControlSocket] 25 Jun 2015 09:31:43.000 : Failed to set socket timeout: An unknown, invalid, or unsupported option or level was specified in a getsockopt or setsockopt call
INFO [FTPControlSocket] 25 Jun 2015 09:31:44.000 : Command encoding=System.Text.CodePageEncoding
DEBUG [ExFTPControlSocket] 25 Jun 2015 09:31:44.000 : Created control-socket: SocksContext=, ProxySettings=NoProxy, RemoteHost=199.217.116.152, controlPort=21, timeout=120000
DEBUG [FTPControlSocket] 25 Jun 2015 09:31:44.000 : StrictReturnCodes=False
DEBUG [FTPControlSocket] 25 Jun 2015 09:31:44.000 : 220-FileZilla Server version 0.9.49 beta
DEBUG [FTPControlSocket] 25 Jun 2015 09:31:44.000 : 220-written by Tim Kosse (tim.kosse@filezilla-project.org)
DEBUG [FTPControlSocket] 25 Jun 2015 09:31:44.000 : 220 Please visit https://filezilla-project.org/

I've got a WARN message on socket timeout (fail to set) almost everytime I use the Connect() method. I am aware that the default socket timeout value in .NET Framework is 0 (infinite), so maybe this explain the issue that I have. Is this correct? Do you guys have any suggestion to bypass the timeout problem in .NET Compact platform?

Thank you.
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

Re: Timeout in edtFTPnet/Compact

by support2 » Fri Jun 26, 2015 5:15 pm

Unfortunately you can't set a timeout on sockets in CF.

The best option is kill the socket when you find the transfer has stalled - you can do that via the BytesTransferred event - maybe have a timer that expires if BytesTransferred isn't fired after x seconds.
no avatar
User

rafael.lasertech

Posts

3

Joined

Thu Jun 25, 2015 10:36 pm

Re: Timeout in edtFTPnet/Compact

by rafael.lasertech » Wed Jul 01, 2015 4:19 am

Hi,

I did something like you said by creating a 'watchdog method (thread)', however UploadFile method still got stuck.

I'm using the UploadFile(string localPath, string remotePath) and when the transfer got stalled, I'm calling:

CancelTransfer();
Close(true);

I saw the log and aparently the socket control is killed internally after calling these methods (30 Jun 2015 15:06:18). And after a few minutes, the Transfer appears to be resuming all by itself but I do not called ResumeTransfer() or UploadFile(). I am doing this correctly when trying to kill the socket/stop the UploadFile method? I do not know why the UploadFile method never ends. Please, can you help me?

INFO [LicenseProperties] 30 Jun 2015 14:58:23.000 : Licence expiry date: 12/31/9999
INFO [LicenseProperties] 30 Jun 2015 14:58:23.000 : Production license
INFO [LicenseProperties] 30 Jun 2015 14:58:24.000 : Licence expiry date: 12/31/9999
INFO [LicenseProperties] 30 Jun 2015 14:58:24.000 : Production license
DEBUG [ExFTPClient] 30 Jun 2015 14:58:24.000 : Connecting to ***:21
DEBUG [HostNameResolver] 30 Jun 2015 14:58:24.000 : Resolving ***
DEBUG [HostNameResolver] 30 Jun 2015 14:58:24.000 : *** resolved to ***
DEBUG [ExFTPControlSocket] 30 Jun 2015 14:58:25.000 : Connecting directly to ftp-server ***:21
INFO [BaseSocket] 30 Jun 2015 14:58:25.000 : Connecting to ***:21
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:27.000 : Setting socket timeout=120000
WARN [FTPControlSocket] 30 Jun 2015 14:58:28.000 : Failed to set socket timeout: An unknown, invalid, or unsupported option or level was specified in a getsockopt or setsockopt call
INFO [FTPControlSocket] 30 Jun 2015 14:58:28.000 : Command encoding=System.Text.CodePageEncoding
DEBUG [ExFTPControlSocket] 30 Jun 2015 14:58:28.000 : Created control-socket: SocksContext=, ProxySettings=NoProxy, RemoteHost=***, controlPort=21, timeout=120000
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:29.000 : StrictReturnCodes=False
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:32.000 : 220-FileZilla Server version 0.9.49 beta
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:32.000 : 220-written by Tim Kosse (tim.kosse@filezilla-project.org)
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:32.000 : 220 Please visit https://filezilla-project.org/
DEBUG [FTPConnection] 30 Jun 2015 14:58:32.000 : Connected to *** (instance=1)
DEBUG [ExFTPConnection] 30 Jun 2015 14:58:32.000 : Starting KeepAlive thread with period 30s
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:32.000 : ---> USER ***
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:33.000 : 331 Password required for ***
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:33.000 : ---> PASS ********
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:34.000 : 230 Logged on
DEBUG [FTPConnection] 30 Jun 2015 14:58:34.000 : Successfully logged in
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:34.000 : ---> FEAT
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:35.000 : 211-Features:
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:35.000 : MDTM
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:35.000 : REST STREAM
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:35.000 : SIZE
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:35.000 : MLST type*;size*;modify*;
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:35.000 : MLSD
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:36.000 : UTF8
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:36.000 : CLNT
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:36.000 : MFMT
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:36.000 : EPSV
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:36.000 : EPRT
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:36.000 : 211 End
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:36.000 : ---> TYPE I
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:37.000 : 200 Type set to I
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:37.000 : ---> PWD
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:41.000 : 257 "/" is current directory.
DEBUG [FTPConnection] 30 Jun 2015 14:58:41.000 : UploadFile(/Storage Card/Alcohol120_1.9.8.7530.rar,/Alcohol120_1.9.8.7530.rar,False)
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:42.000 : ---> PASV
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:43.000 : 227 Entering Passive Mode (***,241,188)
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:43.000 : Server supplied address=***
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:43.000 : Server supplied port=61884
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:43.000 : autoPassiveIPSubstitution=True
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:43.000 : remoteAddr=***
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:43.000 : Substituting server supplied IP (***) with remote host IP (***)
DEBUG [ExFTPControlSocket] 30 Jun 2015 14:58:44.000 : NewPassiveDataSocket(***,61884)
WARN [FTPControlSocket] 30 Jun 2015 14:58:44.000 : Failed to set socket timeout: An unknown, invalid, or unsupported option or level was specified in a getsockopt or setsockopt call
DEBUG [HostNameResolver] 30 Jun 2015 14:58:44.000 : Resolving ***
DEBUG [HostNameResolver] 30 Jun 2015 14:58:44.000 : *** resolved to ***
DEBUG [ExFTPControlSocket] 30 Jun 2015 14:58:44.000 : Connecting directly to ftp-server ***:61884
INFO [BaseSocket] 30 Jun 2015 14:58:44.000 : Connecting to ***:61884
DEBUG [ExFTPPassiveDataSocket] 30 Jun 2015 14:58:50.000 : Created passive data-socket: ProxyConnector=
WARN [FTPDataSocket] 30 Jun 2015 14:58:50.000 : Failed to set socket timeout: An unknown, invalid, or unsupported option or level was specified in a getsockopt or setsockopt call
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:50.000 : ---> STOR /Alcohol120_1.9.8.7530.rar
DEBUG [FTPControlSocket] 30 Jun 2015 14:58:51.000 : 150 Opening data channel for file upload to server of "/Alcohol120_1.9.8.7530.rar"
DEBUG [FTPConnection] 30 Jun 2015 15:06:18.000 : Closing connection (instance=1)
DEBUG [FTPFileFactory] 30 Jun 2015 15:06:18.000 : Defaulting to Unix parsing
INFO [FTPControlSocket] 30 Jun 2015 15:06:19.000 : Killed control socket
DEBUG [ExFTPConnection] 30 Jun 2015 15:06:18.000 : KeepAlive thread finished.
DEBUG [FTPClient] 30 Jun 2015 15:13:08.000 : Closing source stream
ERROR [FTPClient] 30 Jun 2015 15:13:10.000 : Caught exception
ERROR [FTPClient] 30 Jun 2015 15:13:10.000 : System.IO.IOException: Unable to write data to the transport connection.
ERROR [FTPClient] 30 Jun 2015 15:13:10.000 : CAUSED BY - System.Net.Sockets.SocketException: Unable to write data to the transport connection.
ERROR [FTPClient] 30 Jun 2015 15:13:10.000 : SystemException in Put(string,string,bool)
ERROR [FTPClient] 30 Jun 2015 15:13:10.000 : System.IO.IOException: Unable to write data to the transport connection.
ERROR [FTPClient] 30 Jun 2015 15:13:10.000 : CAUSED BY - System.Net.Sockets.SocketException: Unable to write data to the transport connection.
ERROR [FTPClient] 30 Jun 2015 15:13:11.000 : Exception in ValidateTransferOnError())
ERROR [FTPClient] 30 Jun 2015 15:13:11.000 : EnterpriseDT.Net.Ftp.FTPException: The FTP client has not yet connected to the server. The requested action cannot be performed until after a connection has been established.
DEBUG [FTPConnection] 30 Jun 2015 15:13:11.000 : GetLastWriteTime(/Alcohol120_1.9.8.7530.rar)
WARN [FTPConnection] 30 Jun 2015 15:13:11.000 : Could not retrieve modified-time of file /Alcohol120_1.9.8.7530.rar - -1 The FTP client has not yet connected to the server. The requested action cannot be performed until after a connection has been established.
ERROR [ExFTPConnection] 30 Jun 2015 15:13:17.000 : Transfer error on attempt #1 retrying:
ERROR [ExFTPConnection] 30 Jun 2015 15:13:17.000 : System.IO.IOException: Unable to write data to the transport connection.
ERROR [ExFTPConnection] 30 Jun 2015 15:13:17.000 : CAUSED BY - System.Net.Sockets.SocketException: Unable to write data to the transport connection.
DEBUG [ExFTPConnection] 30 Jun 2015 15:13:17.000 : Testing connection
ERROR [ExFTPConnection] 30 Jun 2015 15:13:17.000 : Connection test failed. Closing...
ERROR [ExFTPConnection] 30 Jun 2015 15:13:17.000 : EnterpriseDT.Net.Ftp.FTPException: The FTP client has not yet connected to the server. The requested action cannot be performed until after a connection has been established.
DEBUG [FTPConnection] 30 Jun 2015 15:13:17.000 : Closing connection (instance=1)
DEBUG [FTPFileFactory] 30 Jun 2015 15:13:18.000 : Defaulting to Unix parsing
WARN [ExFTPConnection] 30 Jun 2015 15:13:18.000 : Connection broken - attempting reconnect
INFO [LicenseProperties] 30 Jun 2015 15:13:18.000 : Licence expiry date: 12/31/9999
INFO [LicenseProperties] 30 Jun 2015 15:13:18.000 : Production license
INFO [LicenseProperties] 30 Jun 2015 15:13:18.000 : Licence expiry date: 12/31/9999
INFO [LicenseProperties] 30 Jun 2015 15:13:18.000 : Production license
DEBUG [ExFTPClient] 30 Jun 2015 15:13:19.000 : Connecting to ***:21
DEBUG [HostNameResolver] 30 Jun 2015 15:13:19.000 : Resolving ***
DEBUG [HostNameResolver] 30 Jun 2015 15:13:19.000 : *** resolved to ***
DEBUG [ExFTPControlSocket] 30 Jun 2015 15:13:19.000 : Connecting directly to ftp-server ***:21
INFO [BaseSocket] 30 Jun 2015 15:13:20.000 : Connecting to ***:21
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:22.000 : Setting socket timeout=120000
WARN [FTPControlSocket] 30 Jun 2015 15:13:22.000 : Failed to set socket timeout: An unknown, invalid, or unsupported option or level was specified in a getsockopt or setsockopt call
INFO [FTPControlSocket] 30 Jun 2015 15:13:22.000 : Command encoding=System.Text.CodePageEncoding
DEBUG [ExFTPControlSocket] 30 Jun 2015 15:13:23.000 : Created control-socket: SocksContext=, ProxySettings=NoProxy, RemoteHost=***, controlPort=21, timeout=120000
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:23.000 : StrictReturnCodes=False
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:23.000 : 220-FileZilla Server version 0.9.49 beta
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:23.000 : 220-written by Tim Kosse (tim.kosse@filezilla-project.org)
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:23.000 : 220 Please visit https://filezilla-project.org/
DEBUG [FTPConnection] 30 Jun 2015 15:13:24.000 : Connected to *** (instance=1)
DEBUG [ExFTPConnection] 30 Jun 2015 15:13:24.000 : Starting KeepAlive thread with period 30s
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:24.000 : ---> USER ***
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:29.000 : 331 Password required for ***
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:29.000 : ---> PASS ********
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:29.000 : 230 Logged on
DEBUG [FTPConnection] 30 Jun 2015 15:13:30.000 : Successfully logged in
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:30.000 : ---> FEAT
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:30.000 : 211-Features:
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:30.000 : MDTM
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:30.000 : REST STREAM
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:30.000 : SIZE
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:30.000 : MLST type*;size*;modify*;
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:31.000 : MLSD
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:31.000 : UTF8
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:31.000 : CLNT
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:31.000 : MFMT
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:31.000 : EPSV
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:31.000 : EPRT
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:31.000 : 211 End
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:31.000 : ---> TYPE I
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:32.000 : 200 Type set to I
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:32.000 : ---> CWD /
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:33.000 : 250 CWD successful. "/" is current directory.
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:33.000 : ---> PWD
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:34.000 : 257 "/" is current directory.
INFO [FTPConnection] 30 Jun 2015 15:13:34.000 : Resuming transfer
DEBUG [FTPConnection] 30 Jun 2015 15:13:34.000 : UploadFile(/Storage Card/Alcohol120_1.9.8.7530.rar,/Alcohol120_1.9.8.7530.rar,False)
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:34.000 : ---> SIZE /Alcohol120_1.9.8.7530.rar
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:35.000 : 213 2880
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:35.000 : ---> PASV
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:36.000 : 227 Entering Passive Mode (***,241,213)
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:36.000 : Server supplied address=***
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:36.000 : Server supplied port=61909
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:37.000 : autoPassiveIPSubstitution=True
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:37.000 : remoteAddr=***
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:37.000 : Substituting server supplied IP (***) with remote host IP (***)
DEBUG [ExFTPControlSocket] 30 Jun 2015 15:13:37.000 : NewPassiveDataSocket(***,61909)
WARN [FTPControlSocket] 30 Jun 2015 15:13:37.000 : Failed to set socket timeout: An unknown, invalid, or unsupported option or level was specified in a getsockopt or setsockopt call
DEBUG [HostNameResolver] 30 Jun 2015 15:13:37.000 : Resolving ***
DEBUG [HostNameResolver] 30 Jun 2015 15:13:37.000 : *** resolved to ***
DEBUG [ExFTPControlSocket] 30 Jun 2015 15:13:37.000 : Connecting directly to ftp-server ***:61909
INFO [BaseSocket] 30 Jun 2015 15:13:37.000 : Connecting to ***:61909
DEBUG [ExFTPPassiveDataSocket] 30 Jun 2015 15:13:39.000 : Created passive data-socket: ProxyConnector=
WARN [FTPDataSocket] 30 Jun 2015 15:13:39.000 : Failed to set socket timeout: An unknown, invalid, or unsupported option or level was specified in a getsockopt or setsockopt call
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:39.000 : ---> REST 2880
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:40.000 : 350 Rest supported. Restarting at 2880
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:40.000 : ---> STOR /Alcohol120_1.9.8.7530.rar
DEBUG [FTPControlSocket] 30 Jun 2015 15:13:42.000 : 150 Opening data channel for file upload to server of "/Alcohol120_1.9.8.7530.rar", restarting at offset 2880
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

Re: Timeout in edtFTPnet/Compact

by support2 » Thu Jul 02, 2015 12:39 am

On ExFTPConnection set the property RetryCount to 0. That will stop the transfer retrying after a failure.
no avatar
User

rafael.lasertech

Posts

3

Joined

Thu Jun 25, 2015 10:36 pm

Re: Timeout in edtFTPnet/Compact

by rafael.lasertech » Thu Jul 02, 2015 5:22 am

Hi.

Thank you, now I managed to get around the timeout issue by closing the connection.

Best regards,
Rafael

Who is online

Users browsing this forum: No registered users and 20 guests

Powered by phpBB ® | phpBB3 Style by KomiDesign
cron