Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

tchicken

I solved my problem, it was related to the management of the ports of the server which were not correctly redirected.

Thank you for your help.
martin

Can you answer my questions clearly?
tchicken

It works with a local IP, but not with a DNS name.
martin

So does WinSCP GUI work (on the same local machine)? Can you see the directory contents? Or any other FTP client (on the same local machine)?
tchicken

Thanks,

I've got a time out:
< 2022-07-14 13:43:31.357 Script: Connected
. 2022-07-14 13:43:31.357 Connected
. 2022-07-14 13:43:31.357 Doing startup conversation with host.
< 2022-07-14 13:43:31.357 Script: Starting the session...
> 2022-07-14 13:43:31.357 PWD
< 2022-07-14 13:43:31.419 257 "/" is current directory.
. 2022-07-14 13:43:31.419 Changing directory to "/".
> 2022-07-14 13:43:31.419 CWD /
< 2022-07-14 13:43:31.482 250 CWD command successful
. 2022-07-14 13:43:31.482 Getting current directory name.
> 2022-07-14 13:43:31.482 PWD
< 2022-07-14 13:43:31.544 257 "/" is current directory.
. 2022-07-14 13:43:31.544 Startup conversation with host finished.
< 2022-07-14 13:43:31.544 Script: Session started.
. 2022-07-14 13:43:31.544 File: '/MAJ-20220714.req' [2022-07-14T11:01:57.000Z] [2887525]
. 2022-07-14 13:43:31.544 Copying "/MAJ-20220714.req" to local directory started.
. 2022-07-14 13:43:31.544 Binary transfer mode selected.
. 2022-07-14 13:43:31.560 Starting download of /MAJ-20220714.req
> 2022-07-14 13:43:31.560 TYPE A
< 2022-07-14 13:43:31.638 200 Type set to A
> 2022-07-14 13:43:31.638 PASV
< 2022-07-14 13:43:31.716 227 Entering Passive Mode (82,65,91,6,223,153)
> 2022-07-14 13:43:31.716 MLSD
. 2022-07-14 13:43:31.716 Connecting to 82.65.91.6:57241 ...
< 2022-07-14 13:43:31.810 150 About to start data transfer.
. 2022-07-14 13:43:46.164 Timeout detected. (data connection)
. 2022-07-14 13:43:46.164 Copying files from remote side failed.
. 2022-07-14 13:43:46.164 Connection was lost, asking what to do.
. 2022-07-14 13:43:46.164 Asking user:
. 2022-07-14 13:43:46.164 **Lost connection.** ("Timeout detected. (data connection)","Copying files from remote side failed.")
< 2022-07-14 13:43:46.164 Script: Lost connection.

Probably due to a DNS resolution problem behind a NAT server ... I'm not sure ...
martin

Re: Session.GetFiles loops and does not return my hand

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.
tchicken

Session.GetFiles loops and does not return my hand

Here my code:
Dim Serveur As String
Dim OriIP As String
'***
ProgressBar.Value = 0
ProgressBar.Maximum = 0
'***
If RadioPresles.Checked Then
    Serveur = "PRESLES"
ElseIf RadioLesArcs.Checked Then
    Serveur = "LESARCS"
Else
    Serveur = "LINSELLES"
End If
'***
Call Affichage("Fichier du " & MyDateDonnees & " en cours de téléchargement à partir du serveur " & Serveur, True, False)
'***
If RadioPresles.Checked Then
    OriUri = UriPresles
    OriIP = UriPreslesIn
Else
    If RadioLesArcs.Checked Then
        OriUri = UriLesArcs
        OriIP = UriLesArcsIn
    Else
        OriUri = UriLinselles
        OriIP = UriLinsellesIn
    End If
End If
Interne:
Try
    ' Setup session options
    Dim sessionOptions As New SessionOptions
    With sessionOptions
        .Protocol = Protocol.Ftp
        .FtpMode = FtpMode.Passive
        .PortNumber = 50000
        .HostName = OriUri
        .UserName = userName
        .Password = password
    End With
    Using session As New Session
        session.Open(sessionOptions)
        Dim transferOptions As New TransferOptions
        transferOptions.TransferMode = TransferMode.Binary
        Dim transferResult As TransferOperationResult
        transferResult = session.GetFiles(MyFile, ".\", False, transferOptions)
        transferResult.Check()
    End Using
Catch Erreur As Exception
    '***
    If InStr(Erreur.Message, "192.168.") Then
        OriUri = OriIP
        GoTo Interne
    End If
    VerificationServeurs.BackColor = Color.DarkBlue
    VerificationServeurs.ForeColor = Color.Red
    Call Affichage("Erreur de chargement, veuillez réessayer...", False, False)
    '***
    Exit Sub
End Try
OutputFilePath = My.Application.Info.DirectoryPath & "\" & MyFile
Call Insertions()

The session.GetFiles loops and does not return my hand:
transferResult = session.GetFiles(MyFile, ".\", False, transferOptions)

FileZilla server says:
<Date> Info [Type] Message

<14/07/2022 10:12:21> FTP Session 2398 192.168.0.254 [Response] 220-FileZilla Server 1.4.1
<14/07/2022 10:12:21> FTP Session 2398 192.168.0.254 [Response] 220 Please visit https://filezilla-project.org/
<14/07/2022 10:12:21> FTP Session 2398 192.168.0.254 [Command] USER genturfevo
<14/07/2022 10:12:21> FTP Session 2398 192.168.0.254 [Response] 331 Please, specify the password.
<14/07/2022 10:12:21> FTP Session 2398 192.168.0.254 [Command] PASS ****
<14/07/2022 10:12:21> FTP Session 2398 192.168.0.254 genturfevo [Response] 230 Login successful.
<14/07/2022 10:12:21> FTP Session 2398 192.168.0.254 genturfevo [Command] SYST
<14/07/2022 10:12:21> FTP Session 2398 192.168.0.254 genturfevo [Response] 215 UNIX emulated by FileZilla.
<14/07/2022 10:12:21> FTP Session 2398 192.168.0.254 genturfevo [Command] FEAT
<14/07/2022 10:12:21> FTP Session 2398 192.168.0.254 genturfevo [Response] 211-Features:
<14/07/2022 10:12:21> FTP Session 2398 192.168.0.254 genturfevo [Response] 211 End
<14/07/2022 10:12:21> FTP Session 2398 192.168.0.254 genturfevo [Command] PWD
<14/07/2022 10:12:21> FTP Session 2398 192.168.0.254 genturfevo [Response] 257 "/" is current directory.
<14/07/2022 10:12:21> FTP Session 2398 192.168.0.254 genturfevo [Command] CWD /
<14/07/2022 10:12:21> FTP Session 2398 192.168.0.254 genturfevo [Response] 250 CWD command successful
<14/07/2022 10:12:21> FTP Session 2398 192.168.0.254 genturfevo [Command] PWD
<14/07/2022 10:12:21> FTP Session 2398 192.168.0.254 genturfevo [Response] 257 "/" is current directory.
<14/07/2022 10:12:21> FTP Session 2398 192.168.0.254 genturfevo [Command] TYPE A
<14/07/2022 10:12:21> FTP Session 2398 192.168.0.254 genturfevo [Response] 200 Type set to A
<14/07/2022 10:12:21> FTP Session 2398 192.168.0.254 genturfevo [Command] PASV
<14/07/2022 10:12:21> FTP Session 2398 192.168.0.254 genturfevo [Response] 227 Entering Passive Mode (192,168,0,111,200,229)
<14/07/2022 10:12:21> FTP Session 2398 192.168.0.254 genturfevo [Command] MLSD
<14/07/2022 10:12:21> FTP Session 2398 192.168.0.254 genturfevo [Response] 150 About to start data transfer.
<14/07/2022 10:12:36> FTP Server [Status] Session 2398 ended gracefully.
<14/07/2022 10:12:41> FTP Session 2399 192.168.0.254 [Response] 220-FileZilla Server 1.4.1
<14/07/2022 10:12:41> FTP Session 2399 192.168.0.254 [Response] 220 Please visit https://filezilla-project.org/
<14/07/2022 10:12:41> FTP Session 2399 192.168.0.254 [Command] USER genturfevo
<14/07/2022 10:12:41> FTP Session 2399 192.168.0.254 [Response] 331 Please, specify the password.
<14/07/2022 10:12:41> FTP Session 2399 192.168.0.254 [Command] PASS ****
<14/07/2022 10:12:41> FTP Session 2399 192.168.0.254 genturfevo [Response] 230 Login successful.
<14/07/2022 10:12:41> FTP Session 2399 192.168.0.254 genturfevo [Command] SYST
<14/07/2022 10:12:41> FTP Session 2399 192.168.0.254 genturfevo [Response] 215 UNIX emulated by FileZilla.
<14/07/2022 10:12:41> FTP Session 2399 192.168.0.254 genturfevo [Command] FEAT
<14/07/2022 10:12:41> FTP Session 2399 192.168.0.254 genturfevo [Response] 211-Features:
<14/07/2022 10:12:41> FTP Session 2399 192.168.0.254 genturfevo [Response] 211 End
<14/07/2022 10:12:41> FTP Session 2399 192.168.0.254 genturfevo [Command] PWD
<14/07/2022 10:12:41> FTP Session 2399 192.168.0.254 genturfevo [Response] 257 "/" is current directory.
<14/07/2022 10:12:42> FTP Session 2399 192.168.0.254 genturfevo [Command] CWD /
<14/07/2022 10:12:42> FTP Session 2399 192.168.0.254 genturfevo [Response] 250 CWD command successful
<14/07/2022 10:12:42> FTP Session 2399 192.168.0.254 genturfevo [Command] PWD
<14/07/2022 10:12:42> FTP Session 2399 192.168.0.254 genturfevo [Response] 257 "/" is current directory.
<14/07/2022 10:12:42> FTP Session 2399 192.168.0.254 genturfevo [Command] TYPE A
<14/07/2022 10:12:42> FTP Session 2399 192.168.0.254 genturfevo [Response] 200 Type set to A
<14/07/2022 10:12:42> FTP Session 2399 192.168.0.254 genturfevo [Command] PASV
<14/07/2022 10:12:42> FTP Session 2399 192.168.0.254 genturfevo [Response] 227 Entering Passive Mode (192,168,0,111,198,132)
<14/07/2022 10:12:42> FTP Session 2399 192.168.0.254 genturfevo [Command] MLSD
<14/07/2022 10:12:42> FTP Session 2399 192.168.0.254 genturfevo [Response] 150 About to start data transfer.
<14/07/2022 10:12:57> FTP Server [Status] Session 2399 ended gracefully.

The server is configured to use the FTPS protocol with a let's encrypt certificate

Thanks for your help.
Tchicken.