E
Eric Cory
Hello Gurus
I can't get Dart PowerFTP to do anything. I create the
ftp oblect and set the connection values, but when I do a
get, put or even an invoke for a site command, I always
get the error message "No more results can be returned by
WSALookupServiceNext."
If anyone could give me some advice either about this
problem or where to ask this question, I would apreciate
it.
Here is the code I am using
Public Function TransferFiles() As Boolean
Dim DartFTP As New Dart.PowerTCP.Ftp.Ftp()
Dim StartTime, EndTime, NetTime As Double
Dim DartFTPResults As FtpFile
Dim intBytes As Integer
dim strHostName, strUsername, strPassword As String
strHostName = "ISTPFTP.STATE.WI.US"
strUsername = "JX9256"
strPassword = "CRESTEST"
Dim strErrorMsg, strSiteCommand As String
swrXferLog.WriteLine(" ")
swrXferLog.WriteLine(" ")
swrXferLog.WriteLine("NOW TRANSFER THE FILES")
Try
'set connection values
With DartFTP
DartFTP.Server = strHostName.ToString
DartFTP.Username = strUserName.ToString
DartFTP.Password = strPassword.ToString
DartFTP.Passive = False
End With
blnTransferAborted = False
StartTime = Now.Ticks
swrXferLog.WriteLine(" ")
swrXferLog.WriteLine("Connection values set")
swrXferLog.WriteLine(" Server=" &
DartFTP.Server)
swrXferLog.WriteLine(" Username=" &
DartFTP.Username)
swrXferLog.WriteLine(" Password=" &
DartFTP.Password)
swrXferLog.WriteLine(" ")
Dim fRec As New sFileRec()
Dim strMF1, strPC1, strDCB1, strDir1 As String
Dim intSub As Integer
For intSub = 1 To intFileCount
fRec = FileArray(intSub - 1)
strMF1 = "'" & fRec.MFfilename & "'"
strPC1 = fRec.PCfilename
strDCB1 = fRec.DCBinfo
strDir1 = fRec.UpOrDown
swrXferLog.WriteLine(" ")
swrXferLog.WriteLine(" File " &
intSub.ToString)
swrXferLog.WriteLine(" MF: " & strMF1)
swrXferLog.WriteLine(" PC: " & strPC1)
If strDir1 = "Upload" Then
strSiteCommand = FormatSiteCommand
(strDCB1)
swrXferLog.WriteLine(" DCB: " &
strSiteCommand)
swrXferLog.WriteLine(" ")
'DartFTP.Invoke
(FtpCommand.SiteParameters, strSiteCommand)
'DartFTPResults = DartFTP.Put(strMF1,
strPC1)
swrXferLog.WriteLine("Upload file #" &
intSub.ToString)
swrXferLog.WriteLine(" From " &
strPC1)
swrXferLog.WriteLine(" To " &
strMF1)
swrXferLog.WriteLine(" DCB " &
strSiteCommand)
Else
DartFTPResults = DartFTP.Get(strMF1,
strPC1)
'DartFTP.Get(strMF1, strPC1)
swrXferLog.WriteLine("Download file #"
& intSub.ToString)
swrXferLog.WriteLine(" From " &
strMF1)
swrXferLog.WriteLine(" To " &
strPC1)
swrXferLog.WriteLine(" From " &
DartFTPResults.RemoteFileName)
swrXferLog.WriteLine(" To " &
DartFTPResults.LocalFileName)
swrXferLog.WriteLine(" Bytes " &
DartFTPResults.Count)
End If
Next
EndTime = Now.Ticks
NetTime = (EndTime - StartTime) / 10000000
Catch ex As Exception
swrXferLog.WriteLine(" ")
strErrorMsg = ex.Message
swrXferLog.WriteLine(" ErrorMsg: " &
strErrorMsg)
strErrorMsg = ex.Source
swrXferLog.WriteLine(" ErrorSrc: " &
strErrorMsg)
blnTransferAborted = True
End Try
If DartFTP.Connected Then
DartFTP.Close()
End If
Dim strNow As String
swrXferLog.WriteLine(" ")
strNow = Now.ToString("MM/dd/yy hh:mm:ss")
If blnTransferAborted Then
swrXferLog.WriteLine(strNow & " Error: " &
strErrorMsg)
Else
swrXferLog.WriteLine(strNow & " File
transfer completed successfully")
End If
swrXferLog.Close()
Return Not blnTransferAborted
End Function
I can't get Dart PowerFTP to do anything. I create the
ftp oblect and set the connection values, but when I do a
get, put or even an invoke for a site command, I always
get the error message "No more results can be returned by
WSALookupServiceNext."
If anyone could give me some advice either about this
problem or where to ask this question, I would apreciate
it.
Here is the code I am using
Public Function TransferFiles() As Boolean
Dim DartFTP As New Dart.PowerTCP.Ftp.Ftp()
Dim StartTime, EndTime, NetTime As Double
Dim DartFTPResults As FtpFile
Dim intBytes As Integer
dim strHostName, strUsername, strPassword As String
strHostName = "ISTPFTP.STATE.WI.US"
strUsername = "JX9256"
strPassword = "CRESTEST"
Dim strErrorMsg, strSiteCommand As String
swrXferLog.WriteLine(" ")
swrXferLog.WriteLine(" ")
swrXferLog.WriteLine("NOW TRANSFER THE FILES")
Try
'set connection values
With DartFTP
DartFTP.Server = strHostName.ToString
DartFTP.Username = strUserName.ToString
DartFTP.Password = strPassword.ToString
DartFTP.Passive = False
End With
blnTransferAborted = False
StartTime = Now.Ticks
swrXferLog.WriteLine(" ")
swrXferLog.WriteLine("Connection values set")
swrXferLog.WriteLine(" Server=" &
DartFTP.Server)
swrXferLog.WriteLine(" Username=" &
DartFTP.Username)
swrXferLog.WriteLine(" Password=" &
DartFTP.Password)
swrXferLog.WriteLine(" ")
Dim fRec As New sFileRec()
Dim strMF1, strPC1, strDCB1, strDir1 As String
Dim intSub As Integer
For intSub = 1 To intFileCount
fRec = FileArray(intSub - 1)
strMF1 = "'" & fRec.MFfilename & "'"
strPC1 = fRec.PCfilename
strDCB1 = fRec.DCBinfo
strDir1 = fRec.UpOrDown
swrXferLog.WriteLine(" ")
swrXferLog.WriteLine(" File " &
intSub.ToString)
swrXferLog.WriteLine(" MF: " & strMF1)
swrXferLog.WriteLine(" PC: " & strPC1)
If strDir1 = "Upload" Then
strSiteCommand = FormatSiteCommand
(strDCB1)
swrXferLog.WriteLine(" DCB: " &
strSiteCommand)
swrXferLog.WriteLine(" ")
'DartFTP.Invoke
(FtpCommand.SiteParameters, strSiteCommand)
'DartFTPResults = DartFTP.Put(strMF1,
strPC1)
swrXferLog.WriteLine("Upload file #" &
intSub.ToString)
swrXferLog.WriteLine(" From " &
strPC1)
swrXferLog.WriteLine(" To " &
strMF1)
swrXferLog.WriteLine(" DCB " &
strSiteCommand)
Else
DartFTPResults = DartFTP.Get(strMF1,
strPC1)
'DartFTP.Get(strMF1, strPC1)
swrXferLog.WriteLine("Download file #"
& intSub.ToString)
swrXferLog.WriteLine(" From " &
strMF1)
swrXferLog.WriteLine(" To " &
strPC1)
swrXferLog.WriteLine(" From " &
DartFTPResults.RemoteFileName)
swrXferLog.WriteLine(" To " &
DartFTPResults.LocalFileName)
swrXferLog.WriteLine(" Bytes " &
DartFTPResults.Count)
End If
Next
EndTime = Now.Ticks
NetTime = (EndTime - StartTime) / 10000000
Catch ex As Exception
swrXferLog.WriteLine(" ")
strErrorMsg = ex.Message
swrXferLog.WriteLine(" ErrorMsg: " &
strErrorMsg)
strErrorMsg = ex.Source
swrXferLog.WriteLine(" ErrorSrc: " &
strErrorMsg)
blnTransferAborted = True
End Try
If DartFTP.Connected Then
DartFTP.Close()
End If
Dim strNow As String
swrXferLog.WriteLine(" ")
strNow = Now.ToString("MM/dd/yy hh:mm:ss")
If blnTransferAborted Then
swrXferLog.WriteLine(strNow & " Error: " &
strErrorMsg)
Else
swrXferLog.WriteLine(strNow & " File
transfer completed successfully")
End If
swrXferLog.Close()
Return Not blnTransferAborted
End Function