2010-12-23 72 views
0

我想用Java編寫一個FTP服務器,並且已經關閉了基本功能,但是我找不到或找到關於LIST命令的任何信息。FTP列表命令響應

LIST -a將像

drwxrwxrwx 1 stefan stefan    0 Jan 1 1970 personaluploads 
-rwxrwxrwx 1 stefan stefan    0 Jan 1 1970 serverflags.txt 
-rwxrwxrwx 1 stefan stefan    0 Jan 1 1970 serveroptions.txt 
-rwxrwxrwx 1 stefan stefan    0 Jan 1 1970 levels_npcserver.txt 

在數據連接文件的列表。

我應該返回什麼,只是LIST?我是否通過數據連接或控制連接發送它?

感謝您的幫助。

回答

3

參見RFC 959 - File Transfer Protocol。它有你需要的所有信息。

 
LIST (LIST) 

      This command causes a list to be sent from the server to the 
      passive DTP. If the pathname specifies a directory or other 
      group of files, the server should transfer a list of files 
      in the specified directory. If the pathname specifies a 
      file then the server should send current information on the 
      file. A null argument implies the user's current working or 
      default directory. The data transfer is over the data 
      connection in type ASCII or type EBCDIC. (The user must 
      ensure that the TYPE is appropriately ASCII or EBCDIC). 
      Since the information on a file may vary widely from system 
      to system, this information may be hard to use automatically 
      in a program, but may be quite useful to a human user.