CP4044 – Programming for Systems and Networks Mel Ralph, 21/11/2007, Assig2.doc Page 1 Assignment 2 The basic task is to develop a simple file transfer program in Java. This will be a basic Internet client that uses the methods of the URL class. Remember that it is possible to obtain a file from a public FTP archive via a WWW browser using a URL such as ftp://ftp.scit.wlv.ac.uk/pub. (Try this using a normal WWW browser). Using the methods from the Java class java.net.URL, write a program that will allow a command line user to explore an FTP archive (i.e. display the files and directories in the archive and get files) using simple commands such as CD dirname (change directory), DIR (list directory) and GET filename (get a file and save it locally) entered interactively by the user. The functionality is, in part, inspired by the Linux/Windows command line tool ftp. Basic solution (Grade D) The program will allow the user to perform the basic exploration of a remote archive using the simple commands described above. No particular attempt has been made to interpret and display directory listings in any particular fashion. When a file is transferred it is simply saved in the local directory in which the program has been started. The following are suggestions for improving on the basic solution, with indicative grades: Grade C The program allows access to non-public archives. (The URL syntax is ftp://username:password@host). The program will not crash. Error conditions will be interpreted and suitable messages given to the user. Grade B The GET command will support an extra optional parameter that allows a local filename to be specified. The command LCD dirname will be implemented to allow the local directory to be changed. Checks will be made to determine whether files requested for download will over- write local files and the user is offered a choice if this is detected. Grade A A high standard of command line user interface is expected. Information on download size and time will be logged and displayed. Remote site directory listings will be in a standard form for most different types of site. For extra credit, implement a facility allowing the user to specify multiple files to be transferred using a standard “wild-card” notation. For extra credit investigate adding a file uploading command (i.e. PUT). Submitting the Assignment The deadline for this assignment is Friday, 11th January (week 13). You should submit a printed copy of the program documentation with a floppy disk or CD securely attached containing the program source code and executable files. The program must be written in Java. Source code generation tools should not be used. In assessing your program, credit will be awarded for the observation of good programming practice in both O-O design and implementation. The documentation should include a commented listing of the source code (printed in a non- proportional font). You should also submit a log clearly demonstrating the capabilities of your program. CP4044 – Programming for Systems and Networks Mel Ralph, 21/11/2007, Assig2.doc Page 2 Include a critical evaluation of the program, commenting on the program behaviour (particularly execution time). Reference any sources used other than the lecture and workshop notes. You may be required to demonstrate your program.