FTP error : 503 bad sequence of commands?

2019-07-11 13:55发布

I am using FileZilla FTP Server windows edition. I wrote a java programe to connect to my FTP server, and send FTP raw commands to the server via socket. when I send "LIST", I got 503 error :

(000002)2011/6/1 10:46:56 - (not logged in) (127.0.0.1)> Connected, sending welcome message...
(000002)2011/6/1 10:46:56 - (not logged in) (127.0.0.1)> 220-FileZilla Server version 0.9.37 beta
(000002)2011/6/1 10:46:56 - (not logged in) (127.0.0.1)> 220-written by Tim Kosse (Tim.Kosse@gmx.de)
(000002)2011/6/1 10:46:56 - (not logged in) (127.0.0.1)> 220 Please visit http://sourceforge.net/projects/filezilla/
(000002)2011/6/1 10:46:56 - (not logged in) (127.0.0.1)> USER ggfan
(000002)2011/6/1 10:46:56 - (not logged in) (127.0.0.1)> 331 Password required for ggfan
(000002)2011/6/1 10:46:56 - (not logged in) (127.0.0.1)> PASS *****
(000002)2011/6/1 10:46:56 - ggfan (127.0.0.1)> 230 Logged on
(000002)2011/6/1 10:46:56 - ggfan (127.0.0.1)> LIST 
(000002)2011/6/1 10:46:56 - ggfan (127.0.0.1)> 503 Bad sequence of commands.
(000002)2011/6/1 10:46:56 - ggfan (127.0.0.1)> QUIT
(000002)2011/6/1 10:46:56 - ggfan (127.0.0.1)> 221 Goodbye

please help
best regards

标签: java ftp
1条回答
倾城 Initia
2楼-- · 2019-07-11 14:41

I believe that in order to do a data transfer (and LIST is a data transfer command) you must issue a PORT command first to establish the data connection. The best way to figure this out is to either read the relevant spec, or (more fun) fire up Wireshark and see what actually happens using a working FTP client.

查看更多
登录 后发表回答