Hi, all. new to this ftp stuff. i found this information on the msdn,
but i don't understand some things. why won't this code resolve to a
IP based ftp server? how can i download everything at this site
without a GUI? Thanks ahead of time.
Imports System.IO
Imports System.Net
Imports System.Text
Public Class SimpleFTPClient
Public Function download() As FtpStatusCode
Try
sqlUser = "xxx"
sqlPass = "xxx"
sqlIP = "xxx.xxx.xxx.xx x"
Dim ftpRequest As FtpWebRequest =
CType(WebReques t.Create(sqlIP) , FtpWebRequest)
ftpRequest.Meth od = WebRequestMetho ds.Ftp.Download File
Dim ftpResponse As FtpWebResponse =
CType(ftpReques t.GetResponse, FtpWebResponse)
Dim stream As Stream = Nothing
Dim reader As StreamReader = Nothing
Dim writer As StreamWriter = Nothing
Dim destinationFile As String
destinationFile = "C:\FrankSilvaF TP"
Try
stream = ftpResponse.Get ResponseStream
reader = New StreamReader(st ream, Encoding.UTF8)
writer = New StreamWriter(de stinationFile, False)
writer.Write(re ader.ReadToEnd)
Return ftpResponse.Sta tusCode
Finally
stream.Close()
reader.Close()
writer.Close()
End Try
Catch ex As Exception
Throw ex
End Try
End Function
Public sqlUser As String
Public sqlPass As String
Public sqlIP As String
End Class
but i don't understand some things. why won't this code resolve to a
IP based ftp server? how can i download everything at this site
without a GUI? Thanks ahead of time.
Imports System.IO
Imports System.Net
Imports System.Text
Public Class SimpleFTPClient
Public Function download() As FtpStatusCode
Try
sqlUser = "xxx"
sqlPass = "xxx"
sqlIP = "xxx.xxx.xxx.xx x"
Dim ftpRequest As FtpWebRequest =
CType(WebReques t.Create(sqlIP) , FtpWebRequest)
ftpRequest.Meth od = WebRequestMetho ds.Ftp.Download File
Dim ftpResponse As FtpWebResponse =
CType(ftpReques t.GetResponse, FtpWebResponse)
Dim stream As Stream = Nothing
Dim reader As StreamReader = Nothing
Dim writer As StreamWriter = Nothing
Dim destinationFile As String
destinationFile = "C:\FrankSilvaF TP"
Try
stream = ftpResponse.Get ResponseStream
reader = New StreamReader(st ream, Encoding.UTF8)
writer = New StreamWriter(de stinationFile, False)
writer.Write(re ader.ReadToEnd)
Return ftpResponse.Sta tusCode
Finally
stream.Close()
reader.Close()
writer.Close()
End Try
Catch ex As Exception
Throw ex
End Try
End Function
Public sqlUser As String
Public sqlPass As String
Public sqlIP As String
End Class