public virtual void KillControlChannel() { if (control != null) control.Kill(); control = null; }
/// <summary>Set the control socket explicitly.</summary> /// <param name="control">Control socket reference.</param> internal void Initialize(FTPControlSocket control) { this.control = control; this.control.CommandError += new FTPErrorEventHandler(CommandErrorControl); this.control.AutoPassiveIPSubstitution = autoPassiveIPSubstitution; this.control.SynchronizePassiveConnections = synchronizePassiveConnections; // set up the event handlers so they call back to this object - and can // then be passed on if required control.CommandSent += new FTPMessageHandler(CommandSentControl); control.ReplyReceived += new FTPMessageHandler(ReplyReceivedControl); if (activePortRange != null) control.SetActivePortRange(activePortRange); if (activeIPAddress != null) control.SetActiveIPAddress(activeIPAddress); control.StrictReturnCodes = strictReturnCodes; welcomeMessage = this.control.ValidateConnection().ReplyData; }
/// <summary>Quit the FTP session by sending a <c>QUIT</c> command before closing the socket.</summary> public virtual void Quit() { CheckConnection(true); if (fileFactory != null) fileFactory.System = null; try { FTPReply reply = control.SendCommand("QUIT"); lastValidReply = control.ValidateReply(reply, "221", "226"); } finally { CloseDataSocket(); // ensure we clean up the connection control.Logout(); control = null; } }
/// <summary> /// Quit the FTP session immediately by closing the control socket /// without sending the QUIT command /// </summary> public virtual void QuitImmediately() { CheckConnection(true); fileFactory = null; control.Logout(); control = null; }
/// <summary> /// Set the control socket explicitly /// </summary> /// <param name="control"> control socket reference /// </param> internal void Initialize(FTPControlSocket control) { this.control = control; // set up the event handlers so they call back to this object - and can // then be passed on if required control.CommandSent += new FTPMessageHandler(CommandSentControl); control.ReplyReceived += new FTPMessageHandler(ReplyReceivedControl); }
/// <summary> /// Quit the FTP session /// </summary> public virtual void Quit() { CheckConnection(true); fileFactory = null; try { FTPReply reply = control.SendCommand("QUIT"); string[] validCodes = new string[]{"221", "226"}; lastValidReply = control.ValidateReply(reply, validCodes); } finally { // ensure we clean up the connection control.Logout(); control = null; } }
public FTPClient() { this.dirEmptyStrings = new DirectoryEmptyStrings(); this.transferCompleteStrings = new TransferCompleteStrings(); this.fileNotFoundStrings = new FileNotFoundStrings(); this.modtimeFormats = new string[] { "yyyyMMddHHmmss", "yyyyMMddHHmmss'.'f", "yyyyMMddHHmmss'.'ff", "yyyyMMddHHmmss'.'fff" }; this.control = null; this.data = null; this.timeout = 0x1d4c0; this.noOperationInterval = 0; this.strictReturnCodes = false; this.cancelTransfer = false; this.transferNotifyListings = false; this.resume = false; this.deleteOnFailure = true; this.mdtmSupported = true; this.sizeSupported = true; this.resumeMarker = 0L; this.showHiddenFiles = false; this.monitorInterval = 0x1000L; this.transferBufferSize = 0x1000; this.parserCulture = CultureInfo.InvariantCulture; this.fileFactory = new EnterpriseDT.Net.Ftp.FTPFileFactory(); this.transferType = FTPTransferType.ASCII; this.connectMode = FTPConnectMode.PASV; this.synchronizePassiveConnections = false; this.activePortRange = new PortRange(); this.activeIPAddress = null; this.controlPort = -1; this.remoteHost = null; this.autoPassiveIPSubstitution = false; this.closeStreamsAfterTransfer = true; this.controlEncoding = null; this.dataEncoding = null; this.throttler = null; this.InitBlock(); }
public virtual void QuitImmediately() { if (this.fileFactory != null) { this.fileFactory.System = null; } try { if (this.data != null) { this.data.Close(); } } finally { if (this.control != null) { this.control.Kill(); } this.control = null; this.data = null; } }
public virtual void Quit() { this.CheckConnection(true); if (this.fileFactory != null) { this.fileFactory.System = null; } try { FTPReply reply = this.control.SendCommand("QUIT"); this.lastValidReply = this.control.ValidateReply(reply, new string[] { "221", "226" }); } finally { if (this.data != null) { this.data.Close(); } this.data = null; this.control.Logout(); this.control = null; } }
internal void Initialize(FTPControlSocket control) { this.control = control; this.control.AutoPassiveIPSubstitution = this.autoPassiveIPSubstitution; this.control.SynchronizePassiveConnections = this.synchronizePassiveConnections; control.CommandSent += new FTPMessageHandler(this.CommandSentControl); control.ReplyReceived += new FTPMessageHandler(this.ReplyReceivedControl); if (this.activePortRange != null) { control.SetActivePortRange(this.activePortRange); } if (this.activeIPAddress != null) { control.SetActiveIPAddress(this.activeIPAddress); } control.StrictReturnCodes = this.strictReturnCodes; this.control.ValidateConnection(); }