wget --passive-ftp ftp://unix4.andrew.cmu.edu:34500/test.txt
in both case wget will do a RETR for test.txt. Your server should prepend the root_path in front of this.
Note 1 : the default ftp client (the one you get when you just type "ftp" at the command prompt) on the solaris machines does not support passive mode so do not use that to test your server.
Note 2 : the default wget client on the solaris machines does not send a QUIT command when it exits. It just closes the control connection without sending a QUIT to the server. Your server should be able to handle this case where the client does not explicitly send a QUIT command but just closes its control connection.
I have compiled a modified version of wget which does send the QUIT command before closing the control connection which you can use to test your server with.
You can get this version of wget here. This is a binary file compiled for the solaris sparc machines in the Wean 5 computing clusters. Remember to change the permissions on the binary to make it executable (chmod 755 wget).
other useful files to include are
<fcntl.h> (if you need to set any of the sockets to be non-blocking)
<sys/select.h> (if you are using select)
<pthread.h> (if using pthreads)
<stdio.h> (for printf etc)
<errno.h> (for using the errno feature of c)
<strings.h> (for all the string functions)
The TAs all read the bbs regularly and will answer your query promptly. Also, your query can also be answered by other students who know the answer.
client sends PORT command to the server.
client sends RETR command to the server.
The server responds with a "150 attempting to send file" message (you can change the exact message but the code should be 150.
The server then tries to connect to the clients port. It returns a 425 error message if the connection failed or 426 if the connection was broken halfway. it returns 451 or 551 if it had problems reading the file (no such file etc.) and 226 if the transfer was successful.
For PASV mode, you may want to start a timer after the server sends the 150 mark. Otherwise, if the client does not actually connect to the server, that particular server process may be stuck waiting for a connection. If the timer expires, you can return a 425 error message. You can do this in other ways too. It's up to you.
Can you explain what you will be looking for on error checking so I can make sure my code is as robust as expected?
1) server must work with correct commands
2) server must not crash when sent strange / unrecognized commands
3) server must not crash when asked to send strange files / connect to strange ports etc.
4) server must be able to handle things like the client closing its connection unexpectedly (even during data transfers)
for 2) and 3), the server should send an appropriate error message (as given in Section 2.5) to the client.
e.g., ftp unix4.andrew.cmu.edu
then use the user command to log in and the put command to store a file
Section 2.1 has it wrong. Refer to the example in Section 3. for the exact strings sent by the client.
STORE "name_of_file" (as stated in the project description)
ABORT (as stated in the project description)
Back to CS 15-441 home page.