Jump to content


Photo

FXP Files/Directories C#


  • Please log in to reply
2 replies to this topic

#1 mindweaver

mindweaver
  • Members
  • 7 posts

Posted 01 March 2006 - 07:38 AM

Back again :unsure: 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

#2 mb

mb

    Developer

  • Administrators
  • 11527 posts
  • Gender:
    Male
  • Location:
    Worldwide

Posted 01 March 2006 - 06:22 PM

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

#3 mindweaver

mindweaver
  • Members
  • 7 posts

Posted 01 March 2006 - 11:45 PM

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 :unsure:




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users