Aaron
1
c#
ftp
我正在尝试从FTP服务器检索文件列表,但我得到了一些奇怪的非ASCII响应.
这是我正在使用的代码:
public string[] getFileList(string mask)
{
if(!logined)
{
login();
}
Socket cSocket = createDataSocket();
this.getSslDataStream(cSocket);
sendCommand("PASV");
sendCommand("LIST " + "*"+mask);
stream2.AuthenticateAsClient(remoteHost,
null,
System.Security.Authentication.SslProtocols.Ssl3 |
System.Security.Authentication.SslProtocols.Tls,
true);
if(!(retValue == 150 || retValue == 125))
{
throw new IOException(reply.Substring(4));
}
StringBuilder mes = new StringBuilder();
while(true)
{
int bytes = cSocket.Receive(buffer, buffer.Length, 0);
m