Unable to connect to FTP Server with SOCKS5 using WinSCP

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Unable to connect to FTP Server with SOCKS5 using WinSCP



I choose WinSCP so I can implement a SOCKS5 Proxy into my FTP Client.
With the Proxy commented out I am able to connect and download files from a FTP Server without a proxy.
If I try to connect to the FTP Server with SOCKS5 Proxy I am unable to connect.
Any erros in my proxy configuration or something ? LoginData is correct, works with filezilla.


public void Download(string LocalFile)
{
try
{
// Setup session options
SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Ftp,
HostName = LoginData.Servername,
UserName = LoginData.Username,
Password = LoginData.Passwort,
};

// Configure proxy
sessionOptions.AddRawSettings("ProxyMethod", "2"); // socks5 proxy
sessionOptions.AddRawSettings("ProxyHost", "***"); //host ip
sessionOptions.AddRawSettings("ProxyPort", "***"); //Port
sessionOptions.AddRawSettings("ProxyUsername", "***"); //Username
sessionOptions.AddRawSettings("ProxyPassword", "***"); //Password

using (Session session = new Session())
{
session.DisableVersionCheck = true;

// Connect
session.Open(sessionOptions);

// Download files
TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Binary;

TransferOperationResult transferResult;
transferResult =
session.GetFiles(LoginData.RemoteFile, LocalFile, false, transferOptions);

// Throw on any error
transferResult.Check();

// Print results
foreach (TransferEventArgs transfer in transferResult.Transfers)
{
Console.WriteLine("Download of {0} succeeded", transfer.FileName);
}
}

}
catch (Exception e)
{
Console.WriteLine("Error: {0}", e);
}
}









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Makefile test if variable is not empty

Will Oldham

'Series' object is not callable Error / Statsmodels illegal variable name