Zip Component, Email Component, Encryption Component ActiveX Control for Zip Compression .NET Components for ASP.NET
ActiveX and .NET Components for Zip Compression, Encryption, Email, XML, S/MIME, HTML Email, Character Encoding, Digital Certificates, FTP, and more ASP Email ActiveX Component


Index of Chilkat Blog Posts

September 26, 2006

FTP Data Port Event Callback

A new FTP2 event is being added to allow programs to be notified of the port number used for active data connections for uploading and downloading files. (Active data connections are such that the client creates a data socket, binds to a random port above 1024, notifies the FTP server and listens for a connection request from the FTP server. Passive data connections are the opposite — the FTP server creates the data socket, notifies the client of the port number, and listens for the connection request.)

The "DataPort" event is fired prior to the client notifying the server of the port number (via the PORT command).

The DataPort event is not yet publicly available, but will be included in the next FTP2 version release.

A C# sample is listed here:

<font size=2 face=courier>
        public void OnDataPort(object source, Chilkat.DataPortEventArgs args)
        {
            MessageBox.Show(Convert.ToString(args.Port));
        }
	
        private void button1_Click(object sender, EventArgs e)
        {
            Chilkat.Ftp2 ftp2 = new Chilkat.Ftp2();
            ftp2.UnlockComponent("test");
	
            ftp2.Hostname = "ftp.chilkatsoft.com";
            ftp2.Username = "myLogin";
            ftp2.Password = "myPassword";
	
            ftp2.EnableEvents = true;
            ftp2.OnDataPort += new Chilkat.Ftp2.DataPortEventHandler(OnDataPort);
	
            bool b = ftp2.Connect();
            if (!b)
            {
                MessageBox.Show(ftp2.LastErrorText);
            }
	
            ftp2.ChangeRemoteDir("images");
	
            ftp2.GetFile("dude.gif", "dude.gif");
	
            ftp2.Disconnect();
	
            MessageBox.Show("Done!");
        }
</font>


Privacy Statement. Copyright 2000-2011 Chilkat Software, Inc. All rights reserved.
Send feedback to support@chilkatsoft.com

Components for Microsoft Windows XP, 2000, 2003 Server, Vista, Windows 7, and Windows 95/98/NT4.