当前位置: 首页 > 编程语言 > C#

在C#中从FTP服务器检索文件列表share

时间:2023-04-10 23:20:39 C#

这是我正在使用的代码:publicstring[]getFileList(stringmask){if(!logined){login();套接字cSocket=createDataSocket();this.getSslDataStream(cSocket);sendCommand("PASV");sendCommand("列表"+"*"+掩码);stream2.AuthenticateAsClient(remoteHost,null,System.Security.Authentication.SslProtocols.Ssl3|System.Security.Authentication.SslProtocols.Tls,true);if(!(retValue==150||retValue==125)){thrownewIOException(reply.Substring(4));}StringBuildermes=newStringBuilder();while(true){intbytes=cSocket.Receive(buffer,buffer.Length,0);mes.Append(ASCII.GetString(buffer,0,bytes));如果(字节