VBA and closed Port

Advertisement

OKL
Joined:
Posts:
1
Location:
Germany

VBA and closed Port

Hello,
I have created an Microsoft Access Application with integrated WinSCP to download and upload Files to our FTP Server.

Everything works fine, but if the port for FTPS is closed, the WinSCP is waiting for 120 seconds. The switch .TimeoutInMilliseconds = 5000 does nothing in this case. If there is no connection to the internet or the host is not available, it fails instantly and the dialog to update closes.
Public Function SafeCopy(mysession As Session, ziel As String, quelle As String, direction As Integer, delfile As Boolean) As Boolean
On Error GoTo 2
Dim ergebnis As String
SafeCopy = False
 
    Dim mysessionoptions As New SessionOptions
    With mysessionoptions
        .protocol = protocol.protocol_ftp
        .Hostname = Hostname
        .UserName = ftp_User
        .Password = ftp_Password
        .ftpsecure = ftpsecure.FtpSecure_Explicit
        .TimeoutInMilliseconds = 5000
        '.DisableVersionCheck
    End With
    
    ' Connect
    mysession.Open mysessionoptions
    
    ' Upload files
 
    Dim myTransferOptions As New TransferOptions
  ' Const transfermode As String = "TransferMode_Binary"
    myTransferOptions.transfermode = TransferMode_Binary
    'myTransferOptions.Remove = True
What can I do to check if the port is open or cancel it faster?

Thank you.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,517
Location:
Prague, Czechia

Re: VBA and closed Port

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

Advertisement

You can post new topics in this forum