[Repost] FTP components in C # and simple FTP clients

xiaoxiao2021-03-06  42

Program Description: Original author Jerome LacaiLle, code size: k48. Environment: C #,. Net below is an instructions for the author of the translation. Introduction At this time, I first wrote a C # component, I decided to be a component that implemented FTP. Here is a simple code using this component. I can't guarantee that this component can work well in any situation, but I think I will improve it in the feedback. Add this component to Toolbox (using custom Toolbox) and put it in your FORM. This project includes a simple FTP client.

Code: connection to the FTP server: ftpc.Username = EFUsername.Text; ftpc.Password = EFPassword.Text; ftpc.Hostname = CBFTPServer.Text; ftpc.Connect (); login server: private void ftpc_Connected (object sender, FTPCom.FTPEventArgs e) {ftpc.login ();} Successful connection After the time will be recorded: private void ftpc_logged (Object sender, ftpcom.ftpeventargs e) {ftpc.dir ();} Get a directory list: private void ftpc_dircompleted (Object Sender, FTPCOM.FTPEVENTARGS E) {INT i = 0; int IDImage = 0; string msg; msg = "transfered" E.TOTALBYTES.TOSTRING () "BYTES IN" ((float) E.TimeElapsed / 1000) .tostring () "seconds" CRLF; TextLog.SelectionColor = Color.Black; TextLog.AppendText (msg); ServerView.BeginUpdate (); ServerView.Items.Clear (); ImgListServerSmall.Images.Clear (); ListViewItem lvItem = new ListviewItem (".."); ServerView.Items.Add (LVItem); for (i = 0; i

转载请注明原文地址:https://www.9cbs.com/read-47699.html

New Post(0)