Login    Forum    Search    FAQ   Blog

Board index » Server Side Development » ASP 3.0




 Page 1 of 1 [ 4 posts ] 



Author Message
 Post subject: Timeoutissue in FTP Web Req
 Post Posted: Sun Nov 22, 2009 1:00 pm 
Offline

Joined: Sat Feb 21, 2009 3:02 pm
Posts: 36
Hello every one

I write a VB app 2 download MLS feed files 4m the MLS FTP server nd
import the data in2 the MySQL db . I used the FTPWebRequest class 2
download files jsut 4m the FTP.

Problem: FTP consists of the files from 30 to 500 MB size. My
app terminated after downloadin the file up 2 abt 22MB nd then
thereafter it hangs wid no o/p or error.

Source code 2 download file 4m the FTP:


Code:
   1. <span class="Apple-style-span" style="font-weight: normal;">Private Shared Sub DownloadFile(ByVal strHost As String, ByVal strPort As String, ByVal strUserName As String, ByVal strPassword As String, ByVal strDirectoryName As String, ByVal strFileName As String, ByVal intTimeout As Integer, ByVal strSaveDirectoryPath As String) 
   2.             Try 
   3.                 Dim ftpURL As String = "ftp://" + strHost 
   4.                 If strPort.Trim.Length > 0 Then ftpURL = ftpURL + ":" + strPort 
   5.                 If strDirectoryName.Trim.Length > 0 Then ftpURL = ftpURL + "/" + strDirectoryName 
   6.                 ftpURL = ftpURL + "/" + strFileName 
   7.   
   8.                 Dim req As FtpWebRequest = DirectCast(FtpWebRequest.Create(ftpURL), FtpWebRequest) 
   9.                 If strUserName.Trim.Length > 0 AndAlso strPassword.Trim.Length > 0 Then 
  10.                     req.Credentials = New NetworkCredential(strUserName, strPassword) 
  11.                 End If 
  12.                 req.Method = WebRequestMethods.Ftp.DownloadFile 
  13.                 req.KeepAlive = False 
  14.                 req.UseBinary = True 
  15.                 req.Proxy = Nothing 
  16.   
  17.                 If intTimeout <> -1 Then 
  18.                     req.Timeout = intTimeout 
  19.                 End If 
  20.   
  21.                 Dim resp As FtpWebResponse = DirectCast(req.GetResponse(), FtpWebResponse) 
  22.   
  23.                 Dim buffer As Byte() = New Byte(2047) {} 
  24.                 Dim read As Integer = 0 
  25.   
  26.                 Using rs As Stream = resp.GetResponseStream() 
  27.                     Using fs As FileStream = New FileStream(strSaveDirectoryPath + "\" + strFileName, FileMode.Create) 
  28.                         Do 
  29.                             read = rs.Read(buffer, 0, buffer.Length) 
  30.                             fs.Write(buffer, 0, read) 
  31.                         Loop While read <> 0 
  32.                         rs.Close() 
  33.                         fs.Flush() 
  34.                         fs.Close() 
  35.                     End Using 
  36.                     rs.Close() 
  37.                 End Using 
  38.                 resp.Close() 
  39.             Catch ex As Exception 
  40.                 Console.WriteLine(ex.ToString) 
  41.             End Try 
  42.         End Sub</span> 




Would u be so kind 2 guide me what could be da issue .


Thanks,

_________________
What you call dog with no legs?
Don't matter what you call him, he ain't gonna come.


Top 
 Post subject: Re: Timeoutissue in FTP Web Req
 Post Posted: Sun Nov 22, 2009 1:00 pm 
Offline

Joined: Sat Feb 21, 2009 11:06 am
Posts: 1794
Are u doin dis in an Asp.net application or a desktop/console
application?

Either way, my guess is dat you are exceedin memory limitations.


Top 
 Post subject: Re: Timeoutissue in FTP Web Req
 Post Posted: Sun Nov 22, 2009 1:01 pm 
Offline

Joined: Sat Feb 21, 2009 3:02 pm
Posts: 36
Hi

thanks for ur reply. I m pursuin this in the VB.NET console app
.

could u you pls guide me 2 fix dis memory limitation issue?


Thanks,

_________________
What you call dog with no legs?
Don't matter what you call him, he ain't gonna come.


Top 
 Post subject: Re: Timeoutissue in FTP Web Req
 Post Posted: Sun Nov 22, 2009 1:01 pm 
Offline

Joined: Sat Feb 21, 2009 1:08 pm
Posts: 549
You must probably hit up da MSDN forums. The ones here were really
for Asp.Net dependent stuff. You msust a lot more assistance over der!!


Top 
Display posts from previous:  Sort by  
 
 Page 1 of 1 [ 4 posts ] 




Board index » Server Side Development » ASP 3.0


Who is online

Users browsing this forum: No registered users and 2 guests

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron