Send file and Timeout ?

Mar 12, 2010 at 2:25 PM

Hello, 

First,  thank you for this excellent work.

I wrapped your FTPSClient class in a MSBuild Task to use it in Team Build process.
I also must add an "option" to not use the FTP FEAT command  in the connection process (I don't know exactly why, but i never receive a reply with the FEAT command, i suspect the two level of NAT in my network)
If you want, i can post the source code.
 

When i put a file on the server (IIS 7.5 Windows FTP Server for info), if the transfer take less than the timeout, all is right, if the send time exceed the timeout, il receive an error.

Below the partial log : (sorry but some error message are in French)


File Size: 8 652 593 Byte

     1>c:\tmp\BuildType\TFSBuild.proj(1540,5): error : Impossible de lire les données de la connexion de transport : Une opération non bloquante sur un socket n'a pas pu être achevée immédiatement.

c:\tmp\BuildType\TFSBuild.proj(1540,5): error :    à System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)

c:\tmp\BuildType\TFSBuild.proj(1540,5): error :    à System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)

c:\tmp\BuildType\TFSBuild.proj(1540,5): error :    à System.Net.Security._SslStream.StartFrameHeader(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)

c:\tmp\BuildType\TFSBuild.proj(1540,5): error :    à System.Net.Security._SslStream.StartReading(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)

c:\tmp\BuildType\TFSBuild.proj(1540,5): error :    à System.Net.Security._SslStream.ProcessRead(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)

c:\tmp\BuildType\TFSBuild.proj(1540,5): error :    à System.Net.Security.SslStream.Read(Byte[] buffer, Int32 offset, Int32 count)

c:\tmp\BuildType\TFSBuild.proj(1540,5): error :    à System.IO.StreamReader.ReadBuffer()

c:\tmp\BuildType\TFSBuild.proj(1540,5): error :    à System.IO.StreamReader.ReadLine()

c:\tmp\BuildType\TFSBuild.proj(1540,5): error :    à AlexPilotti.FTPS.Client.FTPSClient.GetReply()

c:\tmp\BuildType\TFSBuild.proj(1540,5): error :    à AlexPilotti.FTPS.Client.FTPSClient.<EndStreamCommand>b__1()

c:\tmp\BuildType\TFSBuild.proj(1540,5): error :    à AlexPilotti.FTPS.Common.FTPStream.Close()

c:\tmp\BuildType\TFSBuild.proj(1540,5): error :    à System.IO.Stream.Dispose()

c:\tmp\BuildType\TFSBuild.proj(1540,5): error :    à AlexPilotti.FTPS.Client.FTPSClient.PutFile(String localFileName, String remoteFileName, FileTransferCallback transferCallback)

c:\tmp\BuildType\TFSBuild.proj(1540,5): error :    à AlexPilotti.FTPS.Client.FTPSClient.PutFiles(String localDirectoryName, String remoteDirectoryName, String filePattern, EPatternStyle patternStyle, Boolean recursive, FileTransferCallback transferCallback)

c:\tmp\BuildType\TFSBuild.proj(1540,5): error :    à AlexPilotti.FTPS.Client.FTPSClient.PutFiles(String localDirectoryName, String remoteDirectoryName, String filePattern, EPatternStyle patternStyle, Boolean recursive, FileTransferCallback transferCallback)

c:\tmp\BuildType\TFSBuild.proj(1540,5): error :    à Zeugmo.Tasks.FTPS.prvDoWildCardPut(FTPSClient client, String localPathPattern)

c:\tmp\BuildType\TFSBuild.proj(1540,5): error :    à Zeugmo.Tasks.FTPS.prvDoPut(FTPSClient client)

c:\tmp\BuildType\TFSBuild.proj(1540,5): error :    à Zeugmo.Tasks.FTPS.prvDoCommand()

c:\tmp\BuildType\TFSBuild.proj(1540,5): error :    à Zeugmo.Tasks.FTPS.Execute()

 

Must I increase the timout value ?
Is it due to the non use of the FEAT command ?

 

Sorry for my english, Nico

 

 

Coordinator
Mar 12, 2010 at 2:39 PM

Hi,

the FEAT command is required to receive the list of supported server features, including FTPS support.

Your exception might be related to the client trying to enstablish an encrypted FTPS data connection anyway, did you specify "ClearText" (aka standard FTP, no FTPS)? By default it uses FTPS.

If yon don't care about encryption, I would just wrap the FEAT command in a try/catch, making sure to throw an exception if anything else than "ClearText" in the connection encryption parameters had been specified.

 

BTW I like the idea of wrapping it in a MSBuild task for VSTS integration. Could you post something more about it?

 

Thanks,

Alessandro Pilotti [ MVP / IIS ]

 

 

 

 

 

Mar 12, 2010 at 3:30 PM
Edited Mar 12, 2010 at 4:00 PM

Thanks for your answer.

I have used an encrypted FTPS (explicit mode) data connection and it works perfectly if the transfer time is lower than the timeout duration (120s by default).

Then, must I increase the timout value ? or is it due to the non use of the FEAT command ?

I uploaded a patch with the modified FTPSClient and the MSBuild Task file.

Thanks,

Nico

Coordinator
Mar 12, 2010 at 9:59 PM

Hi Nico,

looks like the server or one of the firewalls is shutting down the data connection after 120 sec.  

Did you test your connection using a client like Filezilla uploading the same file? I sucpect that one of your network firewalls is shutting down the connection if there's no communication on the control channel for 120s, but that's just a guess by now.

 

Cheers,

Alessandro Pilotti [ MVP / IIS ]

Mar 15, 2010 at 10:01 AM

With Filezilla FTP client, connection stop with no reply of FEAT command.
With Core FTP Lite, it works, nevertheless the "Keep Alive" feature is set to 30s.

I will just increase the connection timeout.

Cheers,

Nico