我用的是c#写的ftp 客户端.可是就算登陆是本地局域网内的服务器,要显示文件列表也很慢
不知道是怎么回事.请各位高手指点一下.小弟在这里多谢了.
下面是获取列表的代码,请各位帮忙分析一下
public string[] getFileList()
{
if (!logined)
{
login();
}
Socket cSocket = createDataSocket();
sendCommand("LIST ");
if (!(retValue == 150 || retValue == 125))
{
// throw new IOException(reply.Substring(4));
}
mes = "";
while (true)
{
int bytes = cSocket.Receive(buffer, buffer.Length, 0);
mes += ASCII.GetString(buffer, 0, bytes);
if (bytes < buffer.Length)
{
break;
}
}
// log.Info(mes);
char[] seperator = { '/n' };
string[] mess = mes.Split(seperator);
cSocket.Close();
readReply();
if (retValue != 226)
{
throw new IOException(reply.Substring(4));
}
return mess;
}