Hi,
I'm writing a real simple program, all it has to do is return the content of a specific ftp-server. But for some reason my List-command do not return any data.
My sourcecode:
Socket s;
string command ="";
string user = "anonymous";
string pass = "
[email protected]";
try
{
int port = 21;
s = new Socket(AddressFamily.InterNetwork , SocketType.Stream, ProtocolType.Tcp);
IPHostEntry iphost = Dns.GetHostByName("ftp.uio.no");
ip = iphost.AddressList[0];//ip of the host name
IPEndPoint iep = new IPEndPoint(ip , port);
s.Connect(iep);
Response();
SendRequest(s, "USER " + user + "\r\n");
Response();
SendRequest(s,"PASS " + pass + "\r\n");
Response();
SendRequest(s,"PASV" + "\r\n");
Response();
SendRequest(s,"LIST" + "\r\n");
MessageBox.Show("finale result:");
Response();
}
catch(Exception test)
{
MessageBox.Show("error listing files: " + test.Message);
}
The response-function works like a charm for user. pass and pasv, but returns no data for the list-command. Hope someone can help me.
y.s.
-la