Jump to content


Photo

SmartFTP Library VB error 17


  • Please log in to reply
3 replies to this topic

#1 bmangold

bmangold
  • Members
  • 2 posts

Posted 06 July 2005 - 08:02 PM

I have purchased and installed the license but am still receiving errors when attempting to connect via VB. The code I am using is below. It worked fine last week, before the free-trial expired.

Thanks.


    'Early Binding "Dual Interface"

    'Note: Force the compiler to use the dual interface if available

    Set objFTP = CreateObject("sfFTPLib.FTPConnection")

    

    'Early Binding "Mid Level"

    'Note: The compiler may use the dual interface

    'Set objFTP = New sfFTPLib.FTPConnection

    

    objFTP.Host = "xx.xx.xx.xx"

    objFTP.Port = 21

    objFTP.Protocol = ftpProtocolNormal 'ftpProtocolSSLExplicit

    objFTP.Username = "xxxxx"

    objFTP.Password = "xxxxx"

    objFTP.Passive = True

    objFTP.LogFile = pwd & "ftp.log"

    

    If objFTP.Connect = sfFTPLib.enumError.ftpErrorSuccess Then

        MsgBox ("Connected to " & objFTP.Host)

        If objFTP.ChangeDirectory("/xxxxx") = sfFTPLib.enumError.ftpErrorSuccess Then

            MsgBox ("ChangeDirectory() successful. (" & objFTP.WorkingDirectory & ")")



            ' Upload File

            Dim nRestart

            nRestart = 0



            Dim strMsg

            If objFTP.UploadFile32(pwd & "xxxxx.xml", "xxxxx.xml", nRestart) = sfFTPLib.enumError.ftpErrorSuccess Then

                strMsg = "UploadFile32() successful." & vbCrLf

                strMsg = strMsg & "LastTransferBytes = " & objFTP.LastTransferBytes32 & " B" & vbCrLf

                strMsg = strMsg & "LastTransferTime = " & objFTP.LastTransferTime & " s" & vbCrLf

                strMsg = strMsg & "LastTransferSpeed = " & objFTP.LastTransferSpeed & " B/s"

                MsgBox (strMsg)

            Else

                strMsg = "UploadFile32() failed. LastError = " & objFTP.LastError & vbCrLf

                strMsg = strMsg & "LastReplyCode = " & objFTP.LastReplyCode & vbCrLf

                strMsg = strMsg & "LastReply = " & objFTP.LastReply & vbCrLf

                MsgBox (strMsg)

            End If

            

            ' Read Directory

            If objFTP.ReadDirectory() = sfFTPLib.enumError.ftpErrorSuccess Then

                Dim objDirectory As sfFTPLib.FTPDirectory

                Set objDirectory = objFTP.Directory

                Dim objItem As sfFTPLib.FTPItem

                Dim strList

                For Each objItem In objDirectory

                    strList = strList & "Type=" & objItem.Type & "; Name=" & objItem.Name & "; Size=" & objItem.Size32 & "; Date=" & Format(objItem.Date, "MM/DD/YYYY HH:NN:SS") & vbCrLf

                Next

                MsgBox (strList)

            Else

                MsgBox ("ReadDirectory() failed. LastError = " & objFTP.LastError)

            End If

        Else

            MsgBox ("ChangeDirectory() failed. LastError = " & objFTP.LastError)

        End If

        

    Else

        MsgBox ("Connect() failed. LastError = " & objFTP.LastError)

    End If



#2 mb

mb

    Developer

  • Administrators
  • 11521 posts
  • Gender:
    Male
  • Location:
    Worldwide

Posted 06 July 2005 - 10:09 PM

You need to call LoadLicenseKeyFile or LoadLicenseKeyData to load your license key.

Regards,
-Mat

#3 bmangold

bmangold
  • Members
  • 2 posts

Posted 06 July 2005 - 10:12 PM

What should the argument be, I couldn't find a good example online.

-Bob

#4 mb

mb

    Developer

  • Administrators
  • 11521 posts
  • Gender:
    Male
  • Location:
    Worldwide

Posted 06 July 2005 - 11:41 PM

Please see the help file. Its the sfFTPLib.chm. You should also find a few examples in the SamplesScript directory.

'///////////////////////////////////////////////////////////////////////////////////

'//

'// LoadLicenseKeyData v1.0 (9. May 2005)

'//

'// Purpose: 

'//   Shows how to load the license key from a string.

'//

'// Copyright (c) 2005 by SmartFTP.com

'//

'///////////////////////////////////////////////////////////////////////////////////



Dim strKey



strKey = strKey & "-----BEGIN KEY-----" & vbCrLf

strKey = strKey & "Product: SmartFTP FTP Library" & vbCrLf

strKey = strKey & "ID: 400000000" & vbCrLf

strKey = strKey & "User: user" & vbCrLf

strKey = strKey & "Company: my company" & vbCrLf

strKey = strKey & "Email: user@host.com" & vbCrLf

strKey = strKey & "Version: 1.0" & vbCrLf

strKey = strKey & "Number of Users: 1" & vbCrLf

strKey = strKey & "Date of Issue: 2005-04-05" & vbCrLf

strKey = strKey & "Maintenance Expiration: 2006-04-05" & vbCrLf

strKey = strKey & "-----BEGIN SIGNATURE-----" & vbCrLf

strKey = strKey & "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" & vbCrLf

strKey = strKey & "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" & vbCrLf

strKey = strKey & "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" & vbCrLf

strKey = strKey & "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" & vbCrLf

strKey = strKey & "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==" & vbCrLf

strKey = strKey & "-----END SIGNATURE-----" & vbCrLf



Dim obj

Set obj = CreateObject("sfFTPLib.FTPConnection")



WScript.Echo "Object created." & vbCrLf



WScript.Echo strKey



If obj.LoadLicenseKeyData(strKey) Then

	WScript.Echo "Success"

Else

	WScript.Echo "Failed"

End If
Regards,
-Mat




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users