Thread: how to implement ftp server C

  1. #1
    Registered User
    Join Date
    May 2012
    Location
    Italy
    Posts
    53

    how to implement ftp server C

    I have to develop 1 FTP (simple) server in C.
    What do i mean with simple?? I mean that FTP server has to support:



    1. authentication (USER, PASS, PORT)
    2. change directory (CD)
    3. file listing (LIST)
    4. file retrive (RETR)

    I have just developed as "split part" the numbers 1-2-3-4 and i have to merge them into main.c. So no problem with them.
    What i don't understand is how to "receive" communications from the client.
    I mean how can implement what the client wants (USER, PASS, CD, LIST, RETR)?
    I've read the rfc959 but i have not totally understood the communication between client and sever.
    Summary:



    1. client connect to server (so into the server this part is the socket "accept(..)"), right?
    2. server send to client "you are connected" right?
    3. client send to server user,password (file 1, auth.c but i don't know how to read when client send to the server the user and password request)
    4. after successful login the server send file list (part 3, list.c, no problem)
    5. the client send to the server the file it wants to download or the changedir command (again, how to read this info from client's request?)
    6. i hope you have understand



    PS: i'm on GNU/Linux

  2. #2
    Registered User
    Join Date
    Mar 2011
    Posts
    546
    I suggest you first master how to send data back and forth through a TCP connection. implement a client and server where the client sends strings, the server receives them, prints them out and responds to the client. without trying to actually do anything with the commands. you could use the FTP commands and responses if you like, or just arbitrary data.

    google 'linux tcp socket programming' and there are multiple hits that describe simple clients and servers.

  3. #3
    Registered User
    Join Date
    May 2012
    Location
    Italy
    Posts
    53
    Thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Connection between proxy server and the server
    By vbx_wx in forum Networking/Device Communication
    Replies: 2
    Last Post: 02-07-2011, 01:51 PM
  2. Send integers to server and server can read them?
    By rahul.hbk007 in forum C Programming
    Replies: 7
    Last Post: 05-02-2010, 10:14 AM
  3. Replies: 9
    Last Post: 11-12-2007, 03:29 PM
  4. What should I Implement next?
    By cboard_member in forum C++ Programming
    Replies: 4
    Last Post: 03-14-2006, 11:37 AM
  5. C#: Server.Execute() and Server.Transfer()
    By Grayson_Peddie in forum Networking/Device Communication
    Replies: 3
    Last Post: 09-24-2003, 06:50 PM

Tags for this Thread