Ftp客户端服务器实现。

问题描述:

是否可以在eclipse中安装java(安装在ubuntu中)?





问题 -

使用套接字实现具有多个客户端的ftp服务器。客户端应该能够访问服务器,选择文件并将其传输到服务器或从服务器传输。客户端应该至少能够运行以下命令:



ls

cd

chmod

lls(客户端上的本地ls)

lcd(客户端上的本地cd)

lchmod(客户端上的本地chmod)

put

get

close



我尝试过:



我试图在java中做,但遇到一些问题,我不知道如何通过java运行这些命令。

Is it possible to do this in java in eclipse (installed in ubuntu)?


Question-
Implement an ftp server with multiple clients using sockets. A client should be able to access the server, choose a file and transfer it to/from the server. A client should be able to run at least the following commands:

ls
cd
chmod
lls (local ls on the client)
lcd (local cd on the client)
lchmod (local chmod on the client)
put
get
close

What I have tried:

I tried to do in java, but getting some problem, I am not sure how to run these command through java.

可以使用各种编程语言来实现这一点。



Eclipse是一个支持多种编程语言的IDE(集成开发环境)和平台。它是一个帮助创建应用程序的工具。但它与创建的应用程序正在做的事情无关。



因为这是快速答案,所以这里无法详细解答你的非常具体的问题。 />


您应该阅读



  • FTP协议

  • 套接字以及它们如何与所选编程语言一起使用

  • 确定客户端应使用哪种用户界面(GUI,命令line)

  • 基本文件操作(在服务器和客户端上实现相关文件系统命令cd,ls,chmod)

It would be possible to do this using various programming languages.

Eclipse is an IDE (Integrated Development Environment) that supports multiple programming languages and platforms. It is a tool to help creating applications. But it is not related to what the created application is doing.

Because this is Quick Answers, your rather unspecific question can't be answered in detail here.

You should read about

  • The FTP protocol
  • Sockets and how they are used with the selected programming language
  • Decide which kind of user interface should be used by the client (GUI, command line)
  • Basic file operations (implementing the related file system commands cd, ls, chmod on server and client)
引用:

我试过用java做的,但是得到了一些问题,我不知道如何通过java运行这些命令。

I tried to do in java, but getting some problem, I am not sure how to run these command through java.

如果您对现有代码有特定问题,请提出一个新问题,向我们展示代码部分,并解释问题。



这些命令不是通过Java运行。用户在客户端中选择或输入它们(例如,更改目录按钮或在命令行上输入 cd< path> ),然后由客户端应用程序处理。例如,对于 cd 命令,您将拥有一个保存当前路径的变量。然后 cd 命令将检查传递的路径是否存在,并在成功时将其分配给变量。其他操作将使用此变量。例如, ls 命令将获取该目录中的文件列表(参见文件listFiles(Java Platform SE 7) [ ^ ])。

If you have a specific problem with existing code, raise a new question, show us the code portion, and explain the problem.

The commands are not run through Java. They are selected or entered by the user in the client (e.g. a Change Directory button or entering cd <path> on the command line) and then processed by the client application. For the cd command for example you would have a variable that holds the current path. Then the cd command will check if the passed path exists and assign it to the variable upon success. Other operations will use this variable. The ls command for example will get a list of files in that directory (see File listFiles (Java Platform SE 7 )[^]).