Jump to content


JubinhoDrak

Member Since 23/10/2008
Offline Last Active 05/02/2016, 15:42
-----

Posts I've Made

In Topic: Problema ao listar pastas em ftp tcpclient (c#)

05/02/2016, 15:44

 

Um pouco do código:           
 send = System.Text.Encoding.UTF8.GetBytes("TYPE I\r\n");
            strm.Write(send, 0, 8);
            b = new byte[256];
            strm.Read(b, 0, 256);
            result = System.Text.Encoding.UTF8.GetString(b);
            send = System.Text.Encoding.UTF8.GetBytes("PASV \r\n");
            strm.Write(send, 0, 7);
            b = new byte[256];
            strm.Read(b, 0, 256);
            result = System.Text.Encoding.UTF8.GetString(b);
            send = System.Text.Encoding.UTF8.GetBytes("MLSD \r\n");
            strm.Write(send, 0, 7);
            b = new byte[256];
            strm.Read(b, 0, 256);
            result = System.Text.Encoding.UTF8.GetString(b);

Eu estou recebendo isso de retorno do servidor:

127.0.0.1:51198> Recv: AUTH TLS
127.0.0.1:51198> Sent: 500 'AUTH': command not understood.
127.0.0.1:51198> Recv: AUTH SSL
127.0.0.1:51198> Sent: 500 'AUTH': command not understood.
127.0.0.1:51198> Recv: USER anonymous
127.0.0.1:51198> Sent: 331 Password required for anonymous.
127.0.0.1:51198> Recv: PASS anon@localhost
127.0.0.1:51198> Sent: 230 User Anonymous logged in.
127.0.0.1:51198> Recv: CLNT FileZilla
127.0.0.1:51198> Sent: 200 Noted OK.
127.0.0.1:51198> Recv: OPTS UTF8 ON
127.0.0.1:51198> Sent: 200 UTF8 ON Ok.
127.0.0.1:51198> Recv: PWD 
127.0.0.1:51198> Sent: 257 "/" is current directory.
127.0.0.1:51198> Recv: TYPE I
127.0.0.1:51198> Sent: 200 Type set to I.
127.0.0.1:51198> Recv: PASV 
127.0.0.1:51198> Sent: 227 Entering Passive Mode (127,0,0,1,199,255).
127.0.0.1:51198> Recv: MLSD 
127.0.0.1:51198> Sent: 150 Opening data connection for directory list.

A questão é que dai para frente eu não consigo pegar a lista de arquivos e pastas no servidor FTP
Me parece que eu tenho que pegar de uma forma assincrona mas não tenho idéia de como fazer.

Alguem que já tentou fazer um cliente ftp através de TCPclient pode me dar uma ajuda? Desde já grato.

 

Graças a ajuda que ninguém tentou ao menos dar eu consegui, pesquisando em inglês eu achei as respostas para as minhas perguntas e aprendi a fazer um servidor e um client ftp funcional.
Com a junção desses 2:
http://stackoverflow...om-passive-mode
https://tools.ietf.org/html/rfc959


IPB Skin By Virteq