How to send arbitrary FTP commands in C#

后端 未结 4 1050
隐瞒了意图╮
隐瞒了意图╮ 2020-12-03 15:46

I have implemented the ability to upload, download, delete, etc. using the FtpWebRequest class in C#. That is fairly straight forward.

What I need to d

4条回答
  •  失恋的感觉
    2020-12-03 16:24

    You can try our Rebex FTP component:

    // create client and connect 
    Ftp client = new Ftp();
    client.Connect("ftp.example.org");
    client.Login("username", "password");
    
    // send SITE command
    // note that QUOTE and SITE are ommited. QUOTE is command line ftp syntax only.
    client.Site("LRECL=132 RECFM=FB");
    
    // send SYST command
    client.SendCommand("SYST");
    FtpResponse response = client.ReadResponse();
    if (response.Group != 2) 
      ; // handle error 
    
    // disconnect 
    client.Disconnect();
    

提交回复
热议问题