FXP Files/Directories C#

Back again I really need to get some things tested before I buy this (so far) awesome ftp lib. This should be the last major function I need to get working. I can't find any straight forward FXP samples. I looked at the script-example but it didn't work for me. I tried the following code:


1. FXP File
			// Load License Key

			sfFTPLib.Global global = new sfFTPLib.Global();

			if (global.LoadLicenseKeyData("xxxx"))

				System.Console.WriteLine("");



			// Create an instance of the Ftp class.

			FTPConnectionMTA ftpSource = new FTPConnectionMTA();

			FTPConnectionMTA ftpDest = new FTPConnectionMTA();



			FTPFXP fxp = new FTPFXP();





			ftpSource.Host = "sxxx";

			ftpSource.Port = xxx;

			ftpSource.Username = "xxx";

			ftpSource.Password = "xxx";

			ftpSource.Passive = true;

			ftpSource.Timeout = 10;

			ftpSource.LISTOption = 6;

			ftpSource.PassiveForceIP = false;

			ftpSource.DataProtection = enumDataProtection.ftpDataProtectionPrivate;

			ftpSource.Protocol = enumProtocol.ftpProtocolSSLExplicit;



			ftpDest.Host = "xxx";

			ftpDest.Port = xxx;

			ftpDest.Username = "xxx";

			ftpDest.Password = "xxx";

			ftpDest.Passive = true;

			ftpDest.Timeout = 10;

			ftpDest.LISTOption = 6;

			ftpDest.PassiveForceIP = false;

			ftpDest.DataProtection = enumDataProtection.ftpDataProtectionPrivate;

			ftpDest.Protocol = enumProtocol.ftpProtocolSSLExplicit;





			sfFTPLib.enumError errSource = ftpSource.Connect();



			if (errSource == sfFTPLib.enumError.ftpErrorSuccess)

			{



				sfFTPLib.enumError errDest = ftpDest.Connect();



				if (errDest == sfFTPLib.enumError.ftpErrorSuccess)

				{



					fxp.Source = ftpSource;

					fxp.Destination = ftpDest;



					fxp.FXPFile("/testfrom/download.gif", "/testto/download.gif", 0, 0);



					Console.WriteLine(fxp.LastError.ToString());

				}



			}
I don't know if it is the right way but it seems like simple way of doing it. This generates an error:

ftpErrorSettingMismatch


2. OnFXPFile Event
fxp.OnFXPFile +=new IFTPFXPEvents_OnFXPFileEventHandler(fxp_OnFXPFile);



public void OnFXPFile(string szSourceFile, string szDestinationFile, int nStartPos) { ... }

This gives me an error aswell, I think I have got the delegates wrong.

Thank you for you patience

Hello ..

One connection has to be with ftpSource.Passive = true;
and the other one with ftpDest.Passive = false;
or vice versa. That's how FXP works.

You should set the data protection of both connections to clear unless your servers support SSCN (unlikely).
ftpSource.DataProtection = enumDataProtection.ftpDataProtectionClear;
ftpDest.DataProtection = enumDataProtection.ftpDataProtectionClear;

Then try again. Include the log of your FTP session all the time.

OnFXPFile:
The function definition should look like:
public void OnFXPFile(string szSourceFile, string szDestinationFile, int nStartPosLo, int nStartPosHi)

Please be aware that your questions go into technical support beyond pre-sales support.

Regards,
SmartFTP

Thanks alot!

Now it seems to work perfectly. And yes, I am totally aware that this is tech support issues. The good thing though is that other users can look at these posts if they get stuck with the same issues