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

You can post new topics in this forum