It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened,
visit the help center.
Closed 7 years ago.
I have to program the code for a client who wants to transfer a file to a server, the protocol RCFTP. The operation should be: the client sends a request to save a portion of the file, the server will respond if you have received this piece without errors. If so, the client will still send pieces of the file until you have submitted all without errors. If a transmission error, the client must send back the piece of file failed.
Would know a little help to get started?
At first, if you want to code an ftp client read really carefully this : RFC959.
To help you for the beginning, here is few steps you need to know (for sure, i won't describe everything, but it will probably help you) :
- Connect your socket (control socket) to your ftp server on the port 21.
- You will receive on your socket a message from the ftp server (code : 220).
- Then you send your login to the ftp server using the command USER and wait for confirmation (331)
- Then send your password using the command PASS and wait for confirmation that you are logged on the server (230).
- Now you can do some operation on the ftp.
To send file you have to use the passive mode :
- Send command PASV, you will get an answer that give you an IP address and a port (227), you will have to parse this message.
- Connect a second socket (a data socket) wit the given configuration.
- Use the command STOR on your control socket (to define the file you want to create on the server)
- Send data through the data socket and when you are done, close data socket.
Then leave your session using on the control socket the command QUIT.
It's clearly easy to code a simple ftp client if you are used to "sockets concept".
Search for socket tutorials using your favourite internet search engine.
I found one here