473,325 Members | 2,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

How can I avoid ftp timout issues?

Hello, can someone please suggest to me how I can keep my ftp connection from
timing out after a large file download?

I am using SSIS and I have tried multiple ways of ftp'ing the files in my
directory to my local hard drive, but the tasks keep failing after a large
file is downloaded. The error I'm getting is:

An error occurred in the requested FTP operation. Detailed error
description: Receiving file "usfile.zip".
The operation timed out

The file is about 120MB.

I tried using the ftp task, as well as writing (reverse engineering) an ftp
script task using FtpWebRequest.Create and both methods work as long as the
files are small.

It looks like the ftp timeout property has to be set between 1 and 300, so
even though I am explicitly assigning a timeout property of 0 in my
connection via script, it is still timing out.

Any suggestions are much appreciated. I've been struggling with this issue
for about a week now.

Thanks!

Jason
http://www.lonestarfinancing.com

Aug 27 '08 #1
7 13710
Jason wrote:
Hello, can someone please suggest to me how I can keep my ftp
connection from timing out after a large file download?

I am using SSIS and I have tried multiple ways of ftp'ing the files
in my directory to my local hard drive, but the tasks keep failing
after a large file is downloaded. The error I'm getting is:

An error occurred in the requested FTP operation. Detailed error
description: Receiving file "usfile.zip".
The operation timed out

The file is about 120MB.

I tried using the ftp task, as well as writing (reverse engineering)
an ftp script task using FtpWebRequest.Create and both methods work
as long as the files are small.

It looks like the ftp timeout property has to be set between 1 and
300, so even though I am explicitly assigning a timeout property of 0
in my connection via script, it is still timing out.

Any suggestions are much appreciated. I've been struggling with this
issue for about a week now.
In addition to a timeout on the client, there is also a timeout on the server.
You may be hitting an FTP connection timeout on the server, which can be
configured on the server end of things. I have done that for HTTP, not FTP, but
Googling it should help. It may just be a property on the FTP site in IIS.

There are some places where a timeout of 0 (no limit) is not accepted, and it
reverts to the default setting. You might also try a large value instead, like
3600 seconds.
Aug 27 '08 #2
Hello Steve,

I checked microsoft's site, and you can see here that the timeout setting
must be between 1 and 300:
http://technet.microsoft.com/en-us/l...t(SQL.90).aspx.

I tried changing it to 0 or a higher value, but it doesn't look it actually
accepts any value other than between 1 and 300.
I've been googling this issue for a week now, and I'm not sure what to do.
Do you know how I can tell if the problem is on my side or on the server?

Thanks,

Jason
http://www.lonestarfinancing.com

"Steve Gerrard" wrote:
Jason wrote:
Hello, can someone please suggest to me how I can keep my ftp
connection from timing out after a large file download?

I am using SSIS and I have tried multiple ways of ftp'ing the files
in my directory to my local hard drive, but the tasks keep failing
after a large file is downloaded. The error I'm getting is:

An error occurred in the requested FTP operation. Detailed error
description: Receiving file "usfile.zip".
The operation timed out

The file is about 120MB.

I tried using the ftp task, as well as writing (reverse engineering)
an ftp script task using FtpWebRequest.Create and both methods work
as long as the files are small.

It looks like the ftp timeout property has to be set between 1 and
300, so even though I am explicitly assigning a timeout property of 0
in my connection via script, it is still timing out.

Any suggestions are much appreciated. I've been struggling with this
issue for about a week now.

In addition to a timeout on the client, there is also a timeout on the server.
You may be hitting an FTP connection timeout on the server, which can be
configured on the server end of things. I have done that for HTTP, not FTP, but
Googling it should help. It may just be a property on the FTP site in IIS.

There are some places where a timeout of 0 (no limit) is not accepted, and it
reverts to the default setting. You might also try a large value instead, like
3600 seconds.
Aug 27 '08 #3
In article <F1**********************************@microsoft.co m>, Jason
<ja*******@online.nospamwrote:
Hello, can someone please suggest to me how I can keep my ftp connection from
timing out after a large file download?
FTP downloads take place on two connections, most likely your command
connection is timing out for lack of use...you might give it a kick and
send it a command every once in a while.

--
J.B. Moreno
Aug 27 '08 #4
Hello JB,

I am new to programming, but below is the code I'm using. It works until a
large file (120MB) is downloaded. Once it downloads, no other files in the
directory are downloaded, and I get an error msg saying my connection timed
out.
Can you send me an example of what I should do based on my code below?

------------
'And we obtain our file(s):

ftp.ReceiveFiles(sbDownloadFiles.ToString().Substr ing(0, _

sbDownloadFiles.ToString.Length - 1).Split("|".ToCharArray()), _

Dts.Variables("FtpDestination").Value.ToString, True, False)
-------------

Also, do I need to set KeepAlive to True? I thought is defaulted to True.

Here is my code:

------------------------------------
Public Sub Main()

Dim ftp As FtpClientConnection

Dim retrieveFiles As Boolean = False

Dim ftpWeb As FtpWebRequest

Try

ftpWeb = CType(FtpWebRequest.Create("ftp://" +
Dts.Variables("FTPURL").Value.ToString + _

"/" + Dts.Variables("FTPDirectory").Value.ToString), FtpWebRequest)

ftpWeb.Credentials = New
NetworkCredential(Dts.Variables("FTPUser").Value.T oString,
Dts.Variables("FTPPassword").Value.ToString())

ftpWeb.Method = WebRequestMethods.Ftp.ListDirectoryDetails

'Using fileReader As StreamReader = File.OpenText(baseFileName)

Dim srResponse As New StreamReader(ftpWeb.GetResponse().GetResponseStrea m())

Dim readLine As String

Dim stringComponents() As String

Dim sbDownloadFiles As New StringBuilder()

Dim fileEnding As String = Dts.Variables("FtpFileEnding").Value.ToString

Dim ignoreDate As Boolean =
Convert.ToBoolean(Dts.Variables("IgnoreDate").Valu e.ToString)

While Not srResponse.EndOfStream()

readLine = srResponse.ReadLine()

If readLine.Trim().EndsWith(fileEnding) Then

stringComponents = readLine.Split(" ".ToCharArray())

'Since the file is updated at least once a month, we just check the day:

If ignoreDate Or Math.Abs(DateTime.Now.Day -
Int32.Parse(stringComponents(17))) < 2 Then

'This file has been modified within the last day or so...

retrieveFiles = True

sbDownloadFiles.Append(stringComponents(19) + "|")

End If

End If

End While

srResponse.Close()

srResponse = Nothing

ftpWeb = Nothing

If retrieveFiles Then

'Now we need to build our FTP connection:

Dim fiRemoteFile As FileInfo

Dim ftpConnectionManager As ConnectionManager

ftpConnectionManager = Dts.Connections.Add("FTP")

ftpConnectionManager.Properties("ServerName").SetV alue(ftpConnectionManager,
Dts.Variables("FTPURL").Value)

ftpConnectionManager.Properties("ServerPort").SetV alue(ftpConnectionManager,
Dts.Variables("FTPPort").Value)

ftpConnectionManager.Properties("ServerUserName"). SetValue(ftpConnectionManager, Dts.Variables("FTPUser").Value)

ftpConnectionManager.Properties("ServerPassword"). SetValue(ftpConnectionManager, Dts.Variables("FTPPassword").Value)

ftpConnectionManager.Properties("Timeout").SetValu e(ftpConnectionManager,
Dts.Variables("FTPTimeout").Value)

ftpConnectionManager.Properties("ChunkSize").SetVa lue(ftpConnectionManager,
Dts.Variables("FtpChunkSize").Value)

ftpConnectionManager.Properties("Retries").SetValu e(ftpConnectionManager,
Dts.Variables("FTPRetries").Value)

ftp = New FtpClientConnection(ftpConnectionManager.AcquireCo nnection(Nothing))

'Next we connect to the ftp server

ftp.Connect()

ftp.SetWorkingDirectory(Dts.Variables("FTPDirector y").Value.ToString)

'And we obtain our file(s):

ftp.ReceiveFiles(sbDownloadFiles.ToString().Substr ing(0, _

sbDownloadFiles.ToString.Length - 1).Split("|".ToCharArray()), _

Dts.Variables("FtpDestination").Value.ToString, True, False)

End If

'If we did not download anything new there is nothing to process...

Dts.Variables("ContinueProcessing").Value = retrieveFiles

Dts.TaskResult = Dts.Results.Success

Catch exError As Exception

Throw exError

Finally

If Not ftpWeb Is Nothing Then

ftpWeb = Nothing

End If

If Not ftp Is Nothing Then

ftp.Close()

End If

End Try

End Sub

-------------------------------------
Thanks,
Jason

"J.B. Moreno" wrote:
In article <F1**********************************@microsoft.co m>, Jason
<ja*******@online.nospamwrote:
Hello, can someone please suggest to me how I can keep my ftp connection from
timing out after a large file download?

FTP downloads take place on two connections, most likely your command
connection is timing out for lack of use...you might give it a kick and
send it a command every once in a while.

--
J.B. Moreno
Aug 27 '08 #5
=?Utf-8?B?SmFzb24=?= <ja*******@online.nospamwrote:
Hello JB,

I am new to programming, but below is the code I'm using. It works until
a large file (120MB) is downloaded. Once it downloads, no other files in
the directory are downloaded, and I get an error msg saying my connection
timed out.

Can you send me an example of what I should do based on my code below?
You probably can't do it with FtpWebRequest, it's not meant to be a full
blown FTP client. If it doesn't work under your circumstances (say your
connecting to an IBM Mainframe, or apparently downloading more than xMB)
then it doesn't work and you'll have to write your own FTP code, or get a
library that does it (not hard to do), and use that instead.

The program that I maintain that does FTP uses a clsFTP converted to VB in
2002 by Vick S.:
<http://www.tek-tips.com/viewthread.cfm?qid=1074156&page=8>.

Changing it back to C# isn't too hard (I did it while trying to add SSL
support).

--
J. Moreno
Aug 28 '08 #6
Hello Jason,

Apart from J. Moreno and Steve's solutions, I'd suggest your trying posting
this SQL Server DTS question to the microsoft.public.sqlserver.dts
newsgroup.

Regards,
Jialiang Ge (ji****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================

Aug 28 '08 #7
On Aug 27, 4:14 pm, Jason <jason2...@online.nospamwrote:
Hello, can someone please suggest to me how I can keep my ftp connection from
timing out after a large file download?

I am using SSIS and I have tried multiple ways of ftp'ing the files in my
directory to my local hard drive, but the tasks keep failing after a large
file is downloaded. The error I'm getting is:

An error occurred in the requested FTP operation. Detailed error
description: Receiving file "usfile.zip".
The operation timed out

The file is about 120MB.

I tried using the ftp task, as well as writing (reverse engineering) an ftp
script task using FtpWebRequest.Create and both methods work as long as the
files are small.

It looks like the ftp timeout property has to be set between 1 and 300, so
even though I am explicitly assigning a timeout property of 0 in my
connection via script, it is still timing out.

Any suggestions are much appreciated. I've been struggling with this issue
for about a week now.

Thanks!

Jasonhttp://www.lonestarfinancing.com
That may not do the trick but you may try, have you tried:

My.Computer.Network.DownloadFile(....) method and increase
"connectionTimeout" parameter to what you want.(It represents 32-bit
integer to specify).

See this:
http://msdn.microsoft.com/en-us/library/ack30t8y.aspx

Onur Güzel
Aug 28 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Matt | last post by:
I am having trouble with the HttpWebRequest.GetRequestStream method. I am posting data to my web server running NT4 iis4 using a loop. So every time the loop executes I want it to post data to...
9
by: Andrew Au | last post by:
Dear all, I am trying to write a piece of software that use Object Oriented design and implement it with C, I did the following == In Object.h == typedef struct ObjectStructure* Object; ...
4
by: mg | last post by:
I can't get WebForm1 to load load automatically after a session timeout, with the following code. How can I do so In Web.config <sessionState mode="InProc timeout="1" / In Global.asax.cs
0
by: Eyal Sharabi Horwitz | last post by:
im trying to use the sqlhelper.filldataset on a few tables with querys that return num of rows ranging from 16 to just shy of 6000, and it always fails to load my last (and largest table) because...
0
by: Perecli Manole | last post by:
I have a need for logged in users to be timed out after 20 min of inactivity. This works well with the built in functionality that ASP.NET provides except for a certain situation. I have a reminder...
2
by: Bernie Yaeger | last post by:
I'm getting the following error - not always, only randomly - when I run a certain routine (the routine is a simple executenonquery and it appears to complete despite the message) against sql...
6
by: roguefeebo | last post by:
Hello everyone, thanks for looking. I'll get right to the point: I'm having problems trying to figure out a hierarchy of menus in C; command-line style. Say, for example the program analyzes a...
14
by: Stephany Young | last post by:
Even though I had my roots and highlights redone just a few days ago, I don't understand why I appear to be having an ongoing blond moment. Is it just me or do others among you not 'get' how to...
5
by: prognoob | last post by:
I have searched online, and what I mostly come across is what these security issues are... for example, Worms, Backdoor Trojan Horses, Hijacking and Impersonation, Denial of Service etc. but I...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.