never used ftp before but this seems to work...
Dim LogDL As FTPConnection = New FTPConnection
'setup ftp
LogDL.AutoLogin = True
LogDL.ConnectMode = FTPConnectMode.ACTIVE
LogDL.ParsingCulture = New System.Globalization.CultureInfo("")
LogDL.UserName = ftpUser
LogDL.Password = ftpPassword
LogDL.ServerAddress = ftpHost
LogDL.ServerPort = ftpPort
LogDL.StrictReturnCodes = True
LogDL.Timeout = 5000
LogDL.TransferBufferSize = 4096
LogDL.TransferNotifyInterval = CType(4096, Long)
LogDL.TransferType = FTPTransferType.BINARY
Try
'connect
LogDL.Connect()
'change remote directory
LogDL.ChangeWorkingDirectory(ftpRemDir)
'Get The file
LogDL.CloseStreamsAfterTransfer = False
Dim str As MemoryStream = New MemoryStream()
LogDL.DownloadStream(str, RemFName)
str.Seek(LastByte, SeekOrigin.Begin)
Dim sr As New StreamReader(str)
'remove next line
Dim sw As New StreamWriter(ftpLocalDir + "streamed.log")
Dim itm As Object
'reading line by line
itm = sr.ReadLine
Do While sr.Peek() >= 0
'discard empty lines
If itm > Nothing Then
'replace with temp db insert function
sw.WriteLine(itm)
End If
'read next line from stream
itm = sr.ReadLine
Loop
'catch bytecount to be inserted to db
Dim ByteCnt As Integer = str.Length
txtResponse.Text = ByteCnt
sr.Close()
sw.Close()
'Close the connection
LogDL.Close()
Catch ex As Exception
txtResponse.Text = vbCrLf & ex.Message
End Try
Is there a better way or is this sufficient.
and how would i implement mode z?