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:
- authentication (USER, PASS, PORT)
- change directory (CD)
- file listing (LIST)
- 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.
- client connect to server (so into the server this part is the socket "accept(..)"), right?
- server send to client "you are connected" right?
- 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)
- after successful login the server send file list (part 3, list.c, no problem)
- 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?)
- i hope you have understand :)
PS: i'm on GNU/Linux