Dart PowerFTP File Transfer Error

  • Thread starter Thread starter Eric Cory
  • Start date Start date
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
 
That's a Winsock Error, not necessarily related to Dart.
http://groups.yahoo.com/group/vcpphelp/message/7606?source=1

http://msdn.microsoft.com/library/d...us/winsock/winsock/wsalookupservicenext_2.asp


I use Dart and it's always been very reliable... There are a lot of risky
operations in your code (risky being defined as things can go wrong that
aren't your code's fault. ) Which line is it failing on? Can you Put to
the server?


Here's a typical snippet I use...(I have the permission properties set
already) However, try catching the specific Dart Exceptions instead of
System.Exception, it should give you a hint to what's happening.

Try

Dim fp As FtpFile = Ftp1.Put(s, Me.Path & shortName)

If File.Exists(modMain.ArchiveDirectory & shortName) Then

File.Delete(modMain.ArchiveDirectory & shortName)

End If

If File.Exists(s) Then File.Move(s, modMain.ArchiveDirectory & shortName)

Me.LogTransmission(modMain.ArchiveDirectory & shortName, 1)

Catch ex As Dart.PowerTCP.SecureFtp.ProtocolException ' or you coud trap
busy

Debug.WriteLine("SecureFTP Exception: " & ex.ToString)

Me.LogTransmission(modMain.ArchiveDirectory & shortName, 0)



Finally

Ftp1.Close()

End Try
 
Back
Top