Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 17 of 17

Thread: FTP protocol implementation

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default FTP protocol implementation

    Hi people!

    I have to write a code for File Transfer Protocol! It says that I only need to write code for client, but it also says that I have
    to run the program and send some files to server. I guess than I also need server side as well. I have to write my own classes, I cann't import some existing classes. I have to connect to the server with password and username and after that send some files to the server. I don't know anything about FTP. Can i maybe do this by Sockets and ports? I worked something with that.


  2. #2
    Administrator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    24,848
    Thanks
    64
    Thanked 2,645 Times in 2,615 Posts

    Default Re: FTP protocol implementation

    I assume that the server handles the FTP protocol. The client code that you're to write would use sockets with ports.

    google for the RFC doc about the FTP protocol.

    Also posted at http://forums.devshed.com/java-help-...ml#post2864533

  3. #3
    Junior Member
    Join Date
    Mar 2013
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: FTP protocol implementation

    Norm thanks for help, but I still have problems.
    Guys, is there anybody to know something about this. When I try to find on google how to write your own code for FTPClient I always find advices to use some already existing classes like appache FTP server, but it does'n help me. It is really important, so if anybody can give me some advice I would appreciate it very much. Is there some source code for that appache FTP server to see how it is done? I know how to connect on server using sockets. I have Filezilla on my computer and I run my FTPClient aplication and it connects on FileZilla server. Now I have to login with username and password and send some files on server.

    I will also post this on another site

  4. #4
    Administrator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    24,848
    Thanks
    64
    Thanked 2,645 Times in 2,615 Posts

    Default Re: FTP protocol implementation

    Did you read the RFC on FTP? It explains how the protocol works.
    Basically you use sockets to send and receive FTP statements with an FTP server.

  5. #5
    Junior Member
    Join Date
    Mar 2013
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: FTP protocol implementation

    I read it,but again I don't know to do it. I will read it again and try do understand it good...

  6. #6
    Administrator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    24,848
    Thanks
    64
    Thanked 2,645 Times in 2,615 Posts

    Default Re: FTP protocol implementation

    The RFC gives you the commands that you need to send to the server and the responses that the server will make: the protocol.

  7. #7
    Junior Member
    Join Date
    Mar 2013
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: FTP protocol implementation

    afet conection to the server I have to send him user and then password, it says in protocol but I dont know how to send it.
    in java maybe something like this?
    OutputStream os=socket.getOutputStream();
    OutputStreamWriter osw=new OutputStreamWriter (os);
    PrintWriter pw=new PrintWriter (osw, true);
    pw.writeLine("user", "USER1");

    --- Update ---

    I did it

  8. #8
    Administrator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    24,848
    Thanks
    64
    Thanked 2,645 Times in 2,615 Posts

    Default Re: FTP protocol implementation

    I did it
    What response did you get?

  9. #9
    Junior Member
    Join Date
    Mar 2013
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: FTP protocol implementation

    I send "user lijepdan"
    and then server asked "331 Password required for lijepdan"
    i send "pass lijepdan123"
    server: "230 Logged on"
    i send "help"
    server:
    USER PASS QUIT CWD PWD PORT PASV TYPE
    LIST REST CDUP RETR STOR SIZE DELE RMD
    MKD RNFR RNTO ABOR SYST NOOP APPE NLST
    MDTM XPWD XCUP XMKD XRMD NOP EPSV EPRT
    AUTH ADAT PBSZ PROT FEAT MODE OPTS HELP
    ALLO MLST MLSD SITE P@SW STRU CLNT MFMT
    HASH

  10. #10
    Junior Member
    Join Date
    Mar 2013
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: FTP protocol implementation

    220-FileZilla Server version 0.9.41 beta
    220 Welcome on server!
    user User1
    331 Password required for user1
    pass lijepdan
    230 Logged on

    help
    214-The following commands are recognized:
    USER PASS QUIT CWD PWD PORT PASV TYPE
    LIST REST CDUP RETR STOR SIZE DELE RMD
    MKD RNFR RNTO ABOR SYST NOOP APPE NLST
    MDTM XPWD XCUP XMKD XRMD NOP EPSV EPRT
    AUTH ADAT PBSZ PROT FEAT MODE OPTS HELP
    ALLO MLST MLSD SITE P@SW STRU CLNT MFMT
    HASH
    214 Have a nice day.

  11. #11
    Junior Member
    Join Date
    Mar 2013
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: FTP protocol implementation

    220-FileZilla Server version 0.9.41 beta
    220 Welcome!
    user User1
    331 Password required for user1
    pass lijepdan
    230 Logged on

  12. #12
    Administrator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    24,848
    Thanks
    64
    Thanked 2,645 Times in 2,615 Posts

    Default Re: FTP protocol implementation

    Looks like you are making progress.

  13. #13
    Junior Member
    Join Date
    Mar 2013
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: FTP protocol implementation

    I finished my FTP Client application!!!!!!!!
    THANKS NORM!! I keep runing into you everywhere.
    You will find this post on some more places!!!!

  14. #14
    Administrator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    24,848
    Thanks
    64
    Thanked 2,645 Times in 2,615 Posts

    Default Re: FTP protocol implementation

    Please post links to the other sites where you have posted questions.

  15. #15

  16. #16
    Administrator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    24,848
    Thanks
    64
    Thanked 2,645 Times in 2,615 Posts

    Default Re: FTP protocol implementation


  17. #17
    Junior Member
    Join Date
    Apr 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: FTP protocol implementation

    Hi,
    I need ti make e client ftp, Please can you send me your code to begin?
    Thnks

Similar Threads

  1. Replies: 0
    Last Post: March 27th, 2012, 08:00
  2. Scanning large FTP directories with apache.commons.net.ftp
    By daniel_el in forum Java Theory & Questions
    Replies: 3
    Last Post: February 10th, 2012, 05:40
  3. simple ftp server and ftp client
    By simontkk2005 in forum Java Networking
    Replies: 4
    Last Post: January 26th, 2011, 09:29
  4. communication protocol
    By isaac in forum Java Networking
    Replies: 1
    Last Post: February 5th, 2010, 07:20
  5. Exception (payword protocol)
    By ThodorisVon in forum What's Wrong With My Code?
    Replies: 6
    Last Post: January 27th, 2010, 12:35