Results 1 to 5 of 5

Thread: Java FTP

  1. #1
    Gnomead's Avatar
    Gnomead is offline Member
    Join Date
    Nov 2010
    Location
    Dublin
    Posts
    3
    Rep Power
    0

    Cool Java FTP

    Hi,

    I'm an engineering student from Ireland and I'm having difficulty finding the information I need. The assignment is this:

    Write a server and a client application which implements a simple file transfer protocol.

    I can't even find anything to get me started on it so if anyone has any links they could send me it would be greatly appreciated.

    The finer details of the assignment are as follows:


    The server module should accept the following commands from the client:

    server_1s : sends the list of files to the client (the content of the index.txt file)

    server_put <file_name> : when the server receives this command it inserts a new entry in the index.txt containing the <file_name> and the path to a new file is opened locally using the same name (<file_name>). The server then copies all the data further received from the client in the newly created file until a null string is received.

    server_get <file_name> : when the server receives this command it searches in index.txt for an entry containing the specified file name. If the corresponding entry is found the server opens the file at the specified path (corresponding to file_name in the index.txt) and sends its content to the client, otherwise the server sends a null string.
    server_quit: the connection is terminated by the server.
    Client:


    The client should provide a command line user interface which accepts the following commands and performs the corresponding operations:

    1s : sends the server_ls command to the server and then prints on the screen the list of files received from the server.

    put <file_name> <file_path>: sends the server_put command to the server and then transfers the content of the file specified by the <file_path> to the server via the previously established connection.

    get <file_name> <file_path>: sends the server_get command to the server and then stores the data sent by the server in the file specified by the <file_path>.

    quit: sends the server_quit command to the server.
    Please fill free to add any new type of message you consider to be useful in the dialog
    between the server and the client to fulfil the user commands.

  2. #2
    Gnomead's Avatar
    Gnomead is offline Member
    Join Date
    Nov 2010
    Location
    Dublin
    Posts
    3
    Rep Power
    0

    Default

    Oh it also has to be run in the command window not using swing or applets

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,304
    Blog Entries
    7
    Rep Power
    20

    Default

    Start by reading the API documentation for the Socket class and the ServerSocket class. If you want your server to be able to serve different clients at the same time you'll need a couple of Threads (one per client) and you have to protect some critical resources against deadlocks or deadly embrace conditions.

    kind regards,

    Jos

  4. #4
    FON
    FON is offline Senior Member
    Join Date
    Dec 2009
    Location
    Belgrade, Serbia
    Posts
    364
    Rep Power
    5

    Default

    I would recommend 4 step learning and working process for you:

    1. Just use applications:
    install free FTP server.
    install free FTP client (like 'FillZila').
    Configure client to connect and exchange files.
    While working with files, pay attention on FTP protocol messages.

    2. Study just basics of FTP protocol and messages.

    3. Create java client. On this forums you will find a lot of examples (most using 'org.apache.commons.net.ftp' )

    Be sure you understand passive mode, and verbose messages and debug so you can see what is going on under.

    4. Start writing client and server.

    When you come to #4 post your questions.

    good luck!

  5. #5
    Gnomead's Avatar
    Gnomead is offline Member
    Join Date
    Nov 2010
    Location
    Dublin
    Posts
    3
    Rep Power
    0

    Default

    thanks guys. Fortunately multiple clients is not required for this assignment(the last one was horrible too). Hopefully this isn't too much work.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •